Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
0e0acbd6
Commit
0e0acbd6
authored
Apr 13, 2022
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
招聘管理-发送Offer
parent
a6d85baa
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
286 additions
and
10 deletions
+286
-10
src/main/java/cn/timer/api/controller/zpgl/ZpglController.java
+0
-6
src/main/java/cn/timer/api/controller/zpgl/sevice/ZpglSendMessageThread.java
+44
-0
src/main/java/cn/timer/api/controller/zpgl/sevice/ZpglService.java
+1
-0
src/main/java/cn/timer/api/controller/zpgl/sevice/ZpglServiceImpl.java
+15
-1
src/main/java/cn/timer/api/dto/email/SendMessageDto.java
+51
-0
src/main/java/cn/timer/api/utils/ZpglMessageTemplate.java
+23
-0
src/main/java/cn/timer/api/utils/email/EmailUtils.java
+146
-0
src/main/resources/application-test.yml
+6
-3
No files found.
src/main/java/cn/timer/api/controller/zpgl/ZpglController.java
View file @
0e0acbd6
...
...
@@ -21,20 +21,14 @@ import cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper;
import
cn.timer.api.dao.qyzx.QyzxEmpLoginMapper
;
import
cn.timer.api.dao.yggl.YgglMainEmpMapper
;
import
cn.timer.api.dao.zpgl.ZpglRcxxMapper
;
import
cn.timer.api.dto.baidu.BaiduTicResumeDto
;
import
cn.timer.api.dto.baidu.ProjectInfo
;
import
cn.timer.api.dto.baidu.ResumeExtract
;
import
cn.timer.api.dto.zpgl.ImportCandidateDto
;
import
cn.timer.api.dto.zpgl.ZpglRcxxDto
;
import
cn.timer.api.dto.zpgl.ZpglRcxxEntryDto
;
import
cn.timer.api.utils.Md5
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
cn.timer.api.utils.baidu.BaiduTicUtil
;
import
cn.timer.api.utils.baidu.Base64
;
import
cn.timer.api.utils.query.BaseQuery
;
import
cn.timer.api.config.enuminterface.YgEnumInterface.jobStatus
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
...
...
src/main/java/cn/timer/api/controller/zpgl/sevice/ZpglSendMessageThread.java
0 → 100644
View file @
0e0acbd6
package
cn
.
timer
.
api
.
controller
.
zpgl
.
sevice
;
import
cn.timer.api.bean.email.SendMessage
;
import
cn.timer.api.dto.email.SendMessageDto
;
import
cn.timer.api.utils.email.EmailUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.mail.javamail.JavaMailSender
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
ZpglSendMessageThread
implements
Runnable
{
private
JavaMailSender
mailSender
;
private
SendMessageDto
sendMessageDto
;
public
ZpglSendMessageThread
(
JavaMailSender
mailSender
,
SendMessageDto
sendMessageDto
){
this
.
mailSender
=
mailSender
;
this
.
sendMessageDto
=
sendMessageDto
;
}
@Override
public
void
run
()
{
try
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
8
);
map
.
put
(
"rcxxName"
,
"吴庆军"
);
map
.
put
(
"bumen"
,
"部门"
);
map
.
put
(
"gangwei"
,
"岗位"
);
map
.
put
(
"rzTime"
,
"2022-04-13"
);
map
.
put
(
"name"
,
"幽狼"
);
map
.
put
(
"username"
,
sendMessageDto
.
getSenderEmail
());
map
.
put
(
"phone"
,
"13560267595"
);
map
.
put
(
"companyName"
,
"广东优领科技服务有限公司"
);
EmailUtils
.
sendThymeleafMail
(
mailSender
,
map
,
sendMessageDto
.
getSubject
(),
new
String
[]{
sendMessageDto
.
getReceiverEmail
()});
SendMessage
sendMessage
=
SendMessage
.
builder
().
build
();
BeanUtils
.
copyProperties
(
sendMessageDto
,
sendMessage
);
sendMessage
.
setCreatedTime
(
new
Date
());
sendMessage
.
insert
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
src/main/java/cn/timer/api/controller/zpgl/sevice/ZpglService.java
View file @
0e0acbd6
...
...
@@ -7,6 +7,7 @@ import cn.timer.api.dto.zpgl.ImportCandidateDto;
import
cn.timer.api.dto.zpgl.ZpglRcxxDto
;
import
cn.timer.api.utils.Result
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.thymeleaf.TemplateEngine
;
/**
* @author wuqingjun
...
...
src/main/java/cn/timer/api/controller/zpgl/sevice/ZpglServiceImpl.java
View file @
0e0acbd6
...
...
@@ -5,10 +5,10 @@ import cn.timer.api.bean.yggl.YgglMainEmp;
import
cn.timer.api.bean.zpgl.*
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.enuminterface.JxglEnumInterface
;
import
cn.timer.api.config.exception.CustomException
;
import
cn.timer.api.controller.kqgl.ClockInTool
;
import
cn.timer.api.dto.baidu.*
;
import
cn.timer.api.bean.clazz.NationClass
;
import
cn.timer.api.dto.email.SendMessageDto
;
import
cn.timer.api.dto.zpgl.ImportCandidateDto
;
import
cn.timer.api.dto.zpgl.ZpglRcxxDto
;
import
cn.timer.api.utils.Result
;
...
...
@@ -21,10 +21,14 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.mail.javamail.JavaMailSender
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.thymeleaf.ITemplateEngine
;
import
org.thymeleaf.TemplateEngine
;
import
javax.transaction.Transactional
;
import
java.text.SimpleDateFormat
;
...
...
@@ -41,16 +45,23 @@ import java.util.List;
@Transactional
(
rollbackOn
=
Exception
.
class
)
public
class
ZpglServiceImpl
implements
ZpglService
{
@Value
(
"${spring.mail.username}"
)
private
String
username
;
@Autowired
private
BaiduTicUtil
baiduTicUtil
;
@Autowired
private
JavaMailSender
mailSender
;
@Autowired
private
ZpglMslcLogService
zpglMslcLogService
;
@Override
public
boolean
updateZpglRcxx
(
UserBean
userBean
,
ZpglRcxxDto
zpglRcxxDto
)
{
boolean
count
=
false
;
ZpglRcxx
zpglRcxxEntity
=
ZpglRcxx
.
builder
().
id
(
zpglRcxxDto
.
getId
()).
build
().
selectById
();
ZpglRcxx
zpglRcxx
=
ZpglRcxx
.
builder
().
id
(
zpglRcxxDto
.
getId
()).
status
(
zpglRcxxDto
.
getStatus
()).
build
();
ZpglMslcLog
zpglMslcLog
=
new
ZpglMslcLog
();
zpglMslcLog
.
setZpglRcxxId
(
zpglRcxxDto
.
getId
());
...
...
@@ -115,6 +126,9 @@ public class ZpglServiceImpl implements ZpglService {
detail
=
ZpglMessageTemplate
.
print
(
ZpglMessageTemplate
.
OFFER
,
new
String
[]{
userBean
.
getQyzxEmpLogin
().
getUsername
()});
//发送offer
SendMessageDto
sendMessage
=
SendMessageDto
.
builder
().
senderEmail
(
username
).
subject
(
"广东优领科技服务有限公司录用函"
).
createdUser
(
userBean
.
getEmpNum
()).
content
(
"邮件内容"
).
receiverEmail
(
zpglRcxxEntity
.
getMail
()).
build
();
Thread
pthread
=
new
Thread
(
new
ZpglSendMessageThread
(
mailSender
,
sendMessage
));
pthread
.
start
();
break
;
case
8
:
zpglRcxxStatus
=
JxglEnumInterface
.
MslcLogStatus
.
OTHER
.
getType
();
...
...
src/main/java/cn/timer/api/dto/email/SendMessageDto.java
0 → 100644
View file @
0e0acbd6
package
cn
.
timer
.
api
.
dto
.
email
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022-4-13 10:05:49
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
SendMessageDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1599962875587367209L
;
@ApiModelProperty
(
value
=
"创建id"
)
private
Integer
createdUser
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createdTime
;
@ApiModelProperty
(
value
=
"邮件主题"
)
private
String
subject
;
@ApiModelProperty
(
value
=
"邮件内容"
)
private
String
content
;
@ApiModelProperty
(
value
=
"收件人邮箱"
)
private
String
receiverEmail
;
@ApiModelProperty
(
value
=
"发件人邮箱"
)
private
String
senderEmail
;
}
src/main/java/cn/timer/api/utils/ZpglMessageTemplate.java
View file @
0e0acbd6
...
...
@@ -22,6 +22,29 @@ public class ZpglMessageTemplate {
public
static
final
String
INTERVIEWED_ENTRYING
=
"{0} 将候选人状态从[{3}]更改为[面试淘汰], 淘汰原因:{1},备注:{2}"
;
public
static
final
String
OFFER_ENTRYING
=
"{0} 将候选人状态从[{3}}]更改为[录用淘汰], 淘汰原因:{1},备注:{2}"
;
public
static
final
String
OFFER_TEMPLATE
=
"<!DOCTYPE html><html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:th=\"http://www.thymeleaf.org\"><body><div><p style=\" line-height: 1.5;\">尊敬的<span>曾业龙</span></p>"
+
"<p style=\" line-height: 1.5;\"><br></p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">感谢您对公司的认可,非常荣幸地通知您,您已被我司正式录用,欢迎您加入<span>广东黑猫信息科技有限公司</span></p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">您所入职的部门:<span>人事部</span></p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">您所入职的岗位:<span>结算岗</span></p>"
+
"<p style=\" line-height: 1.5;\"><br></p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">入职所需的材料和证件</p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">1. 原单位离职证明(加盖原单位公章)1份</p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">2. 身份证原件</p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">3. 学位证、毕业证原件</p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">4. 相关资格证书原件</p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">5. 入职体检证明</p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\"><br></p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">请您于<span>2018-08-06</span>带以上材料,进行报到</p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\"><br></p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">联系人:<span>陶湘宇</span></p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">联系电话:<span>18665645253</span></p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">联系人邮箱:<span></span></p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\"><br></p>"
+
"<p style=\"text-indent: 2em; line-height: 1.5;\">收到此通知后,请您点击底部按钮进行回复确认,再次欢迎您加入!<span>广东黑猫信息科技有限公司</span>!</p>"
+
"<p style=\" line-height: 1.5;\"><br></p></div>"
+
"</body></html>"
;
public
static
String
print
(
String
template
,
String
[]
values
)
{
if
(
null
==
values
||
values
.
length
==
0
)
{
return
template
;
...
...
src/main/java/cn/timer/api/utils/email/EmailUtils.java
0 → 100644
View file @
0e0acbd6
package
cn
.
timer
.
api
.
utils
.
email
;
import
cn.timer.api.utils.ZpglMessageTemplate
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.mail.SimpleMailMessage
;
import
org.springframework.mail.javamail.JavaMailSender
;
import
org.springframework.mail.javamail.MimeMessageHelper
;
import
org.springframework.stereotype.Component
;
import
org.thymeleaf.context.Context
;
import
org.thymeleaf.util.MapUtils
;
import
org.thymeleaf.util.StringUtils
;
import
javax.mail.MessagingException
;
import
javax.mail.internet.MimeMessage
;
import
java.util.Map
;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/13
*/
@Component
public
class
EmailUtils
{
/**
* 发送人邮箱
*/
private
static
String
from
;
@Value
(
"${spring.mail.username}"
)
private
void
setFrom
(
String
from
)
{
EmailUtils
.
from
=
from
;
}
/**
* 解析页
*/
private
static
String
html
;
@Value
(
"${spring.mail.thymeleaf-html}"
)
private
void
setHtml
(
String
html
)
{
EmailUtils
.
html
=
html
;
}
/**
* 普通发送邮件
*
* @param text
* @param toMails
* @throws MessagingException
*/
public
static
int
sendSimpleMail
(
JavaMailSender
javaMailSender
,
String
text
,
String
subject
,
String
...
toMails
)
{
// text or toMails is null
if
(
StringUtils
.
isEmpty
(
text
)
||
ArrayUtils
.
isEmpty
(
toMails
))
{
return
0
;
}
try
{
SimpleMailMessage
message
=
new
SimpleMailMessage
();
message
.
setSubject
(
subject
);
message
.
setFrom
(
from
);
message
.
setBcc
(
from
);
message
.
setTo
(
toMails
);
message
.
setText
(
text
);
javaMailSender
.
send
(
message
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
0
;
}
return
1
;
}
/**
* 发送 thymeleaf 页面邮件 - 单参数
*
* @param goldCoinCode
* @param toMails
* @param subject
* @throws MessagingException
*/
public
static
int
sendThymeleafMail
(
JavaMailSender
javaMailSender
,
String
goldCoinCode
,
String
subject
,
String
...
toMails
)
{
// goldCoinCode is null
if
(
StringUtils
.
isEmpty
(
goldCoinCode
))
{
return
0
;
}
// 发送邮件
return
sendThymeleafMail
(
javaMailSender
,
null
,
goldCoinCode
,
subject
,
toMails
);
}
/**
* 发送 thymeleaf 页面邮件 - 多参数
*
* @param map
* @param toMails
* @param subject
* @throws MessagingException
*/
public
static
int
sendThymeleafMail
(
JavaMailSender
javaMailSender
,
Map
<
String
,
Object
>
map
,
String
subject
,
String
...
toMails
)
{
// map is null
if
(
MapUtils
.
isEmpty
(
map
))
{
return
0
;
}
// 发送邮件
return
sendThymeleafMail
(
javaMailSender
,
map
,
null
,
subject
,
toMails
);
}
/**
* 发送 thymeleaf 页面邮件 - 最终执行
*
* @param map
* @param toMails
* @param subject
* @throws MessagingException
*/
private
static
int
sendThymeleafMail
(
JavaMailSender
javaMailSender
,
Map
<
String
,
Object
>
map
,
String
goldCoinCode
,
String
subject
,
String
...
toMails
)
{
// toMails is null
if
(
ArrayUtils
.
isEmpty
(
toMails
))
{
return
0
;
}
try
{
MimeMessage
mimeMessage
=
javaMailSender
.
createMimeMessage
();
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
mimeMessage
,
true
);
helper
.
setSubject
(
subject
);
helper
.
setFrom
(
from
);
helper
.
setBcc
(
from
);
helper
.
setTo
(
toMails
);
Context
context
=
new
Context
();
if
(!
MapUtils
.
isEmpty
(
map
))
{
context
.
setVariables
(
map
);
}
else
{
context
.
setVariable
(
"GoldCoinCode"
,
goldCoinCode
);
}
//String process = templateEngine.process(html, context);
helper
.
setText
(
ZpglMessageTemplate
.
OFFER_TEMPLATE
,
true
);
javaMailSender
.
send
(
mimeMessage
);
}
catch
(
MessagingException
e
)
{
e
.
printStackTrace
();
return
0
;
}
return
1
;
}
}
src/main/resources/application-test.yml
View file @
0e0acbd6
...
...
@@ -97,10 +97,13 @@ spring:
invert
:
false
# Whether images should be inverted for dark terminal themes.
mail
:
port
:
465
host
:
smtp.youlingrc.com
username
:
postmaster@youlingrc.com
password
:
YoulingRC2020
protocol
:
smtp
#host: smtp.163.com
host
:
220.181.15.161
username
:
youlingrc123@163.com
password
:
RIMBNJJQNKYNVUWL
default-encoding
:
utf-8
thymeleaf-html
:
/static/8timer/offer.html
properties
:
mail
:
smtp
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment