Skip to content

Commit

Permalink
[代码优化](v2.6):定时任务告警邮箱优化,邮箱为空不调用发送逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
elunez committed Jan 29, 2021
1 parent 9fc0524 commit fdf82d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
* @date 2019-01-07
*/
@Async
@SuppressWarnings({"unchecked","all"})
public class ExecutionJob extends QuartzJobBean {

/** 该处仅供参考 */
Expand Down Expand Up @@ -108,8 +107,10 @@ public void executeInternal(JobExecutionContext context) {
if(quartzJob.getEmail() != null){
EmailService emailService = SpringContextHolder.getBean(EmailService.class);
// 邮箱报警
EmailVo emailVo = taskAlarm(quartzJob, ThrowableUtil.getStackTrace(e));
emailService.send(emailVo, emailService.find());
if(StringUtils.isNoneBlank(quartzJob.getEmail())){
EmailVo emailVo = taskAlarm(quartzJob, ThrowableUtil.getStackTrace(e));
emailService.send(emailVo, emailService.find());
}
}
} finally {
quartzLogRepository.save(log);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<log4jdbc.version>1.16</log4jdbc.version>
<swagger.version>2.9.2</swagger.version>
<fastjson.version>1.2.70</fastjson.version>
<druid.version>1.1.22</druid.version>
<druid.version>1.1.24</druid.version>
<commons-pool2.version>2.5.0</commons-pool2.version>
<mapstruct.version>1.3.1.Final</mapstruct.version>
</properties>
Expand Down

0 comments on commit fdf82d2

Please sign in to comment.