From 07d6fd2c5c6a35a33ad0dd9556b63fd6156d0974 Mon Sep 17 00:00:00 2001 From: KillerADO <wayne8692wayne8692@gmail.com> Date: 星期四, 23 十二月 2021 16:01:01 +0800 Subject: [PATCH] [fix] 暫時移除客戶預約的業務邏輯,因sit db尚未更新顧問的email --- pamapi/src/main/java/com/pollex/pam/service/SendMsgService.java | 77 -------------------------------------- 1 files changed, 0 insertions(+), 77 deletions(-) diff --git a/pamapi/src/main/java/com/pollex/pam/service/SendMsgService.java b/pamapi/src/main/java/com/pollex/pam/service/SendMsgService.java index 9f44d91..bbe3e96 100644 --- a/pamapi/src/main/java/com/pollex/pam/service/SendMsgService.java +++ b/pamapi/src/main/java/com/pollex/pam/service/SendMsgService.java @@ -45,83 +45,6 @@ @Autowired SpringTemplateEngine springTemplateEngine; - public void sendAppointmentNotify(Appointment appointment) { - Assert.notNull(appointment); - - log.debug("is need sending notify msg = {}", applicationProperties.isSendNotifyMsg()); - if(applicationProperties.isSendNotifyMsg()) { - log.debug("sending appointment notify, appointmentId = {}", appointment.getId()); - sendAppointmentNotifyBySMS(appointment); - sendAppointmentNotifyByEmail(appointment); - - // todo ��蝣箄�������瘙蝙�html mail - // sendAppointmentNotifyByHtmlEmail(appointment); - } - } - - private void sendAppointmentNotifyBySMS(Appointment appointment) throws SendSMSFailException { - String msg = getAppointmentNotifyWording(appointment); - String consultantMobile = consultantRepository.findOneByAgentNo(appointment.getAgentNo()).get().getPhoneNumber(); - - try { - sendMsgBySMS(consultantMobile, msg); - } catch (SendSMSFailException e) { - log.debug("send sms failed, appointment Id = {}", appointment.getId(), e); - } - } - - private void sendAppointmentNotifyByEmail(Appointment appointment) { - // todo ��敺靽�頂蝯勗�辣靽∠拳 (銝行�閮剖��葉) - String senderEmail = applicationProperties.getEmail().getSenderEmail(); - String consultantEmail = consultantRepository.findOneByAgentNo(appointment.getAgentNo()).get().getEmail(); - String content = getAppointmentNotifyWording(appointment); - - try { - sendMsgByEmail(senderEmail, consultantEmail, EMAIL_SUBJECT, content, false); - } catch (SendEmailFailException e) { - log.debug("send email failed, appointment Id = {}", appointment.getId(), e); - } - } - - private void sendAppointmentNotifyByHtmlEmail(Appointment appointment) { - // todo ��敺靽�頂蝯勗�辣靽∠拳 (銝行�閮剖��葉) - String senderEmail = applicationProperties.getEmail().getSenderEmail(); - String consultantEmail = consultantRepository.findOneByAgentNo(appointment.getAgentNo()).get().getEmail(); - String customerMobile = appointment.getPhone(); - String normalContent; - - if(StringUtils.hasText(customerMobile)) { - normalContent = "閬芣��“��憟踝����蝑�靽���像������嚗府摰X����Ⅳ�" + customerMobile + "\n"; - } - else { - normalContent = "閬芣��“��憟踝����蝑�靽���像������\n"; - } - - Context context = new Context(); - context.setVariable("content", normalContent); - context.setVariable("urlHint", getAppointmentDetailUrl(appointment.getId())); - String content = springTemplateEngine.process("mail/appointmentNotifyEmail", context); - - try { - sendMsgByEmail(senderEmail, consultantEmail, EMAIL_SUBJECT, content, true); - } catch (SendEmailFailException e) { - log.debug("send email failed, appointment Id = {}", appointment.getId(), e); - } - } - - private String getAppointmentNotifyWording(Appointment appointment) { - String normalContent; - if(StringUtils.hasText(appointment.getPhone())) { - normalContent = "閬芣��“��憟踝����蝑�靽���像������嚗府摰X����Ⅳ�" + appointment.getPhone() + "\n"; - } - else { - normalContent = "閬芣��“��憟踝����蝑�靽���像������\n"; - } - - String urlContent = "暺�雯��嚗�" + getAppointmentDetailUrl(appointment.getId()) + " �����像������"; - return normalContent + urlContent; - } - public SendSMSResponse sendMsgBySMS(String toMobile, String content) throws SendSMSFailException { SMS smsProperties = applicationProperties.getSms(); -- Gitblit v1.8.0