From c4f664ac6ff3060b82ae8d2108ed07bbc3cf9222 Mon Sep 17 00:00:00 2001 From: Mila <Mila@pollex.com.tw> Date: 星期三, 29 十二月 2021 12:31:04 +0800 Subject: [PATCH] Merge branch 'master' of https://192.168.0.10:8443/r/pcalife/PAM --- pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java b/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java index ad552b0..06b9eb0 100644 --- a/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java +++ b/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java @@ -9,6 +9,7 @@ import com.pollex.pam.config.ApplicationProperties; import com.pollex.pam.service.dto.AppointmentUpdateDTO; import com.pollex.pam.web.rest.errors.SendEmailFailException; +import com.pollex.pam.web.rest.errors.SendSMSFailException; import io.jsonwebtoken.lang.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -188,8 +189,12 @@ String consultantMobile = consultantService.findByAgentNo(appointment.getAgentNo()).getPhoneNumber(); try { - sendMsgService.sendMsgBySMS(consultantMobile, msg); - } catch (Exception e) { + if(StringUtils.hasText(consultantMobile)) { + sendMsgService.sendMsgBySMS(consultantMobile, msg); + } + + throw new SendEmailFailException("the consultant does not have mobile!"); + } catch (SendSMSFailException e) { log.warn("send appointment notify by sms was fail, appointment Id = {}", appointment.getId(), e); } } @@ -226,9 +231,13 @@ String content = springTemplateEngine.process("mail/appointmentNotifyEmail", context); try { - sendMsgService.sendMsgByEmail(senderEmail, consultantEmail, NOTIFY_EMAIL_SUBJECT, content, true); + if(StringUtils.hasText(consultantEmail)) { + sendMsgService.sendMsgByEmail(senderEmail, consultantEmail, NOTIFY_EMAIL_SUBJECT, content, true); + } + + throw new SendEmailFailException("the consultant does not have email!"); } catch (SendEmailFailException e) { - log.warn("send email failed, appointment Id = {}", appointment.getId(), e); + log.warn("send appointment notify by email was fail, appointment Id = {}", appointment.getId(), e); } } -- Gitblit v1.8.0