邀请面试完善
This commit is contained in:
parent
5f36e35e43
commit
4b4f2002cd
|
@ -7,10 +7,7 @@ import com.yzdx.AiInterviewer.entity.InvitePromote;
|
||||||
import com.yzdx.AiInterviewer.entity.LogoEntity;
|
import com.yzdx.AiInterviewer.entity.LogoEntity;
|
||||||
import com.yzdx.AiInterviewer.entity.dto.InvitePromoteDto;
|
import com.yzdx.AiInterviewer.entity.dto.InvitePromoteDto;
|
||||||
import com.yzdx.AiInterviewer.mapper.InvitePromoteMapper;
|
import com.yzdx.AiInterviewer.mapper.InvitePromoteMapper;
|
||||||
import com.yzdx.AiInterviewer.service.InterviewBackgroundService;
|
import com.yzdx.AiInterviewer.service.*;
|
||||||
import com.yzdx.AiInterviewer.service.InterviewImagesService;
|
|
||||||
import com.yzdx.AiInterviewer.service.InterviewLogoService;
|
|
||||||
import com.yzdx.AiInterviewer.service.InvitePromoteService;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
@ -34,6 +31,8 @@ public class InterviewController {
|
||||||
private InterviewBackgroundService backgroundService;
|
private InterviewBackgroundService backgroundService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private InvitePromoteService invitePromoteService;
|
private InvitePromoteService invitePromoteService;
|
||||||
|
@Autowired
|
||||||
|
private InterviewNoticeService interviewNoticeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取公司logo
|
* 获取公司logo
|
||||||
|
@ -250,6 +249,27 @@ public class InterviewController {
|
||||||
return R.success(invitePromote);
|
return R.success(invitePromote);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/sendInterviewNotice")
|
||||||
|
public R sendInterviewNotice(@RequestBody Map<String,Object> 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("邀请成功");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package com.yzdx.AiInterviewer.controller.VxController;
|
package com.yzdx.AiInterviewer.controller.VxController;
|
||||||
|
|
||||||
import com.yzdx.AiInterviewer.comment.R;
|
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.VxCarouselChartService;
|
||||||
import com.yzdx.AiInterviewer.service.VxService.VxInterviewApplicationService;
|
import com.yzdx.AiInterviewer.service.VxService.VxInterviewApplicationService;
|
||||||
import com.yzdx.AiInterviewer.service.VxService.VxInterviewRecordService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ public class VxInterviewController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private VxInterviewApplicationService vxInterviewApplicationService;
|
private VxInterviewApplicationService vxInterviewApplicationService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private VxInterviewRecordService vxInterviewRecordService;
|
private InterviewNoticeService interviewNoticeService;
|
||||||
|
|
||||||
@GetMapping("/getCarouselChart")
|
@GetMapping("/getCarouselChart")
|
||||||
public R getCarouselChart(){
|
public R getCarouselChart(){
|
||||||
|
@ -37,15 +38,13 @@ public class VxInterviewController {
|
||||||
}
|
}
|
||||||
return R.success("申请成功");
|
return R.success("申请成功");
|
||||||
}
|
}
|
||||||
@GetMapping("getInterviewRecord")
|
@GetMapping("/getInterviewNotice")
|
||||||
public R getInterviewRecordList(Integer userId,Integer noticeId){
|
public R getInterviewNotice(Integer userId){
|
||||||
List<VxInterviewRecordDto> list=vxInterviewRecordService.getInterviewRecordList(userId,noticeId);
|
|
||||||
return R.success(list);
|
List<VxNoticeDto> VxNoticeDtoList = interviewNoticeService.getInterviewNoticeByUserId(userId);
|
||||||
}
|
|
||||||
@GetMapping("/searchInterviewRecord")
|
return R.success(VxNoticeDtoList);
|
||||||
public R searchInterviewRecordList(String searchCompany,Integer noticeId){
|
|
||||||
List<VxInterviewRecordDto> list=vxInterviewRecordService.searchInterviewRecordList(searchCompany,noticeId);
|
|
||||||
return R.success(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -27,4 +27,6 @@ public class VxInterviewNotice extends BaseEntity {
|
||||||
private Integer jobId;
|
private Integer jobId;
|
||||||
@ApiModelProperty("招聘面试id")
|
@ApiModelProperty("招聘面试id")
|
||||||
private Integer postId;
|
private Integer postId;
|
||||||
|
|
||||||
|
private Integer inviteId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<InterviewNotice>{
|
|
||||||
|
|
||||||
}
|
|
|
@ -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<VxInterviewNotice> {
|
||||||
|
/**
|
||||||
|
* 添加面试通知
|
||||||
|
* @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<VxNoticeDto> getInterviewNoticeByUserId(Integer userId);
|
||||||
|
|
||||||
|
}
|
|
@ -4,5 +4,24 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewApplication;
|
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewApplication;
|
||||||
|
|
||||||
public interface VxInterviewApplicationService extends IService<VxInterviewApplication> {
|
public interface VxInterviewApplicationService extends IService<VxInterviewApplication> {
|
||||||
|
/**
|
||||||
|
* vx投递简历
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param jobId 投递岗位id
|
||||||
|
* @param postingId 招聘的id
|
||||||
|
* @param companyEncoding 投递的公司
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
Integer addInterviewApplication(Integer jobId, Integer userId, Integer postingId, String companyEncoding);
|
Integer addInterviewApplication(Integer jobId, Integer userId, Integer postingId, String companyEncoding);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hr端获取面试申请
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class VxInterviewApplicationServiceImpl extends ServiceImpl<VxInterviewAp
|
||||||
vxInterviewApplication1.setUpdateTime(TimeUtil.getTime());
|
vxInterviewApplication1.setUpdateTime(TimeUtil.getTime());
|
||||||
vxInterviewApplication1.setCreateUser(userId);
|
vxInterviewApplication1.setCreateUser(userId);
|
||||||
vxInterviewApplication1.setUpdateUser(userId);
|
vxInterviewApplication1.setUpdateUser(userId);
|
||||||
int insert = vxInterviewApplicationMapper.insert(vxInterviewApplication1);
|
Integer insert = vxInterviewApplicationMapper.insert(vxInterviewApplication1);
|
||||||
return insert;
|
return insert;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,146 @@
|
||||||
|
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.JobEntity;
|
||||||
|
import com.yzdx.AiInterviewer.entity.User;
|
||||||
|
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxNoticeDto;
|
||||||
|
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewNotice;
|
||||||
|
import com.yzdx.AiInterviewer.mapper.JobMapper;
|
||||||
|
import com.yzdx.AiInterviewer.mapper.UserMapper;
|
||||||
|
import com.yzdx.AiInterviewer.mapper.VxMapper.InterviewNoticeMapper;
|
||||||
|
import com.yzdx.AiInterviewer.service.CompanyService;
|
||||||
|
import com.yzdx.AiInterviewer.service.InterviewNoticeService;
|
||||||
|
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.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class InterviewNoticeServiceImpl extends ServiceImpl<InterviewNoticeMapper, VxInterviewNotice> 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<VxInterviewNotice> 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<VxNoticeDto> getInterviewNoticeByUserId(Integer userId) {
|
||||||
|
LambdaQueryWrapper<VxInterviewNotice> queryWrapper=new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
queryWrapper.eq(VxInterviewNotice::getRecipient,userId);
|
||||||
|
|
||||||
|
List<VxInterviewNotice> vxInterviewNotices = interviewNoticeMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
|
List<VxNoticeDto> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -47,7 +47,7 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(avatar!=null){
|
if(avatar!=null||email!=null){
|
||||||
|
|
||||||
LambdaQueryWrapper<User> queryWrapper1=new LambdaQueryWrapper<User>();
|
LambdaQueryWrapper<User> queryWrapper1=new LambdaQueryWrapper<User>();
|
||||||
|
|
||||||
|
@ -55,7 +55,19 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
|
||||||
|
|
||||||
User findUser = userMapper.selectOne(queryWrapper1);
|
User findUser = userMapper.selectOne(queryWrapper1);
|
||||||
|
|
||||||
|
findUser.setUsername(name);
|
||||||
|
|
||||||
findUser.setAvatar(avatar);
|
findUser.setAvatar(avatar);
|
||||||
|
|
||||||
|
findUser.setEmail(email);
|
||||||
|
|
||||||
|
findUser.setPhone(phone);
|
||||||
|
|
||||||
|
Integer rows = userMapper.updateById(findUser);
|
||||||
|
|
||||||
|
if(rows!=1){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Resume resume=new Resume();
|
Resume resume=new Resume();
|
||||||
|
@ -262,13 +274,21 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
|
||||||
Map<String,Object> result=new HashMap<>();
|
Map<String,Object> result=new HashMap<>();
|
||||||
if(avatar!=null){
|
if(avatar!=null){
|
||||||
|
|
||||||
LambdaQueryWrapper<User> queryWrapper1=new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<User> queryWrapper1=new LambdaQueryWrapper<User>();
|
||||||
|
|
||||||
queryWrapper1.eq(User::getId,userId);
|
queryWrapper1.eq(User::getId,userId);
|
||||||
|
|
||||||
User findUser = userMapper.selectOne(queryWrapper1);
|
User findUser = userMapper.selectOne(queryWrapper1);
|
||||||
|
|
||||||
|
findUser.setUsername(name);
|
||||||
|
|
||||||
findUser.setAvatar(avatar);
|
findUser.setAvatar(avatar);
|
||||||
|
|
||||||
|
findUser.setEmail(email);
|
||||||
|
|
||||||
|
findUser.setPhone(phone);
|
||||||
|
|
||||||
|
Integer rows = userMapper.updateById(findUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
Resume resume=new Resume();
|
Resume resume=new Resume();
|
||||||
|
|
|
@ -31,9 +31,7 @@ public class EmailUtil {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static String sendEmail(String email) {
|
public static String sendEmail(String email,String userName,String companyName,String jobName) {
|
||||||
String code=RandomCodeUtil.random(6);
|
|
||||||
log.info(code);
|
|
||||||
Transport ts = null;
|
Transport ts = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -63,7 +61,7 @@ public class EmailUtil {
|
||||||
});
|
});
|
||||||
|
|
||||||
//开启Session的debug模式,这样就可以查看到程序发送Email的运行状态
|
//开启Session的debug模式,这样就可以查看到程序发送Email的运行状态
|
||||||
session.setDebug(true);
|
session.setDebug(false);
|
||||||
|
|
||||||
//2、通过session得到transport对象
|
//2、通过session得到transport对象
|
||||||
ts = session.getTransport();
|
ts = session.getTransport();
|
||||||
|
@ -82,24 +80,24 @@ public class EmailUtil {
|
||||||
message.setRecipient(Message.RecipientType.TO, new InternetAddress(email));
|
message.setRecipient(Message.RecipientType.TO, new InternetAddress(email));
|
||||||
|
|
||||||
//4-4,邮件标题
|
//4-4,邮件标题
|
||||||
message.setSubject("扬城直聘:");
|
message.setSubject("扬城直聘:"+companyName);
|
||||||
|
|
||||||
//4-5,邮件文本内容
|
//4-5,邮件文本内容
|
||||||
message.setContent("我是测试!", "text/html;charset=UTF-8");
|
message.setContent("<h1>"+userName+"先生,你好!</h1> 您已获得本公司"+"["+jobName+"]AI面试资格,请打开微信小程序,点击面试通知查看详情","text/html;charset=UTF-8");
|
||||||
|
|
||||||
//4-6,发送邮件
|
//4-6,发送邮件
|
||||||
ts.sendMessage(message, message.getAllRecipients());
|
ts.sendMessage(message, message.getAllRecipients());
|
||||||
//5,关闭连接
|
//5,关闭连接
|
||||||
ts.close();
|
ts.close();
|
||||||
|
|
||||||
return code;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return "发送邮件失败";
|
return "发送邮件失败";
|
||||||
}
|
}
|
||||||
|
return "发送成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
sendEmail("2660820526@qq.com");
|
sendEmail("2209176490@qq.com","Jerry","小米有限责任公司","java程序员");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue