| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |