| | |
| | | Optional<String> optionalPhone = Optional.ofNullable(consultant.getPhoneNumber()).filter(StringUtils::hasText); |
| | | Optional<String> optionalEmail = Optional.ofNullable(consultant.getEmail()).filter(StringUtils::hasText); |
| | | |
| | | String emailContent = getAppointmentPendingNotifyEmailContent(pendingAppointmentsSum); |
| | | String emailContent = getAppointmentPendingNotifyEmailContent(pendingAppointmentsSum, getAppointmentPendingNotifyUrl()); |
| | | |
| | | optionalPhone.ifPresent(phone -> { |
| | | sendMsgService.sendMsgBySMS(phone, String.format("您有%s則預約單未進行聯繫,請盡速處理", pendingAppointmentsSum)); |
| | | sendMsgService.sendMsgBySMS(phone, String.format("您有%s則預約單未進行聯繫,請盡速處理,點擊網址:%s" |
| | | , pendingAppointmentsSum, getAppointmentPendingNotifyUrl())); |
| | | }); |
| | | optionalEmail.ifPresent(email -> { |
| | | sendMsgService.sendMsgByEmail(email, NOT_CONTACTED_NOTIFY_SUBJECT, emailContent, true); |
| | |
| | | personalNotificationService.createNotFillAppointmentSatisfactionNumberToCustomer(customerId, notFillSatisfactions.size()) |
| | | ); |
| | | } |
| | | |
| | | private boolean isAppointmentExpiringNotifyNotOnLimit(AppointmentCustomerView appointment) { |
| | | int sendNotifyToCustomerRecordSum = |
| | | appointmentExpiringNotifyRecordRepository.findAllByAppointmentId(appointment.getId()).size(); |
| | |
| | | return sendNotifyToCustomerRecordSum < Constants.SEND_EXPIRING_NOTIFY_LIMIT; |
| | | } |
| | | |
| | | private String getAppointmentPendingNotifyUrl() { |
| | | // todo: 確認顧問登入網址為何 |
| | | return applicationProperties.getFrontEndDomain() + ""; |
| | | } |
| | | |
| | | private String getAppointmentExpiringNotifyUrl(Long appointmentId) { |
| | | return applicationProperties.getFrontEndDomain() + "?notContactAppointmentId=" + appointmentId; |
| | | } |
| | | |
| | | private String getAppointmentPendingNotifyEmailContent(int sum) { |
| | | private String getAppointmentPendingNotifyEmailContent(int sum, String notifyUrl) { |
| | | Context context = new Context(); |
| | | context.setVariable("pendingAppointmentSum", sum); |
| | | context.setVariable("notifyUrl", notifyUrl); |
| | | return springTemplateEngine.process("mail/appointmentPendingNotifyEmail", context); |
| | | } |
| | | |