| | |
| | | .filter(appointment -> |
| | | appointmentService.isAppointmentDateNotInIntervalFromNow(appointment, Constants.APPOINTMENT_EXPIRING_PHONE_INTERVAL, Constants.APPOINTMENT_EXPIRING_EMAIL_INTERVAL) |
| | | ) |
| | | .filter(this::isAppointmentNotifyNotOnLimit) |
| | | .filter(this::isAppointmentExpiringNotifyNotOnLimit) |
| | | .collect(Collectors.toList()); |
| | | |
| | | allByCommunicateStatus.forEach(appointment -> { |
| | |
| | | |
| | | optionalPhone.ifPresent(phone -> |
| | | sendMsgService.sendMsgBySMS(phone, String.format("很抱歉!您預約%s顧問正忙碌中,請您取消預約並改選其他顧問,請點擊網址:%s" |
| | | , consultant.getName(), getAppointmentUrl(appointment.getId()))) |
| | | , consultant.getName(), getAppointmentExpiringNotifyUrl(appointment.getId()))) |
| | | ); |
| | | optionalEmail.ifPresent(email -> |
| | | sendMsgService.sendMsgByEmail(email, NOT_CONTACTED_NOTIFY_SUBJECT, getAppointmentExpiringNotifyEmail(consultant.getName(), getAppointmentUrl(appointment.getId())), true) |
| | | sendMsgService.sendMsgByEmail(email, NOT_CONTACTED_NOTIFY_SUBJECT, getAppointmentExpiringNotifyEmail(consultant.getName(), getAppointmentExpiringNotifyUrl(appointment.getId())), true) |
| | | ); |
| | | |
| | | AppointmentExpiringNotifyRecord record = new AppointmentExpiringNotifyRecord(); |
| | |
| | | } |
| | | |
| | | // todo 需確認該時間, otis todo=134497 |
| | | @Scheduled(cron = "0 0 9 * * *") |
| | | @Scheduled(cron = "0 30 8 * * *") |
| | | public void sendNotFillSatisfactionToPersonalNotification() { |
| | | Map<Long, List<Satisfaction>> customerNotFillSatisfactions = satisfactionService.getByStatus(SatisfactionStatusEnum.UNFILLED) |
| | | .stream() |
| | |
| | | ); |
| | | } |
| | | |
| | | private boolean isAppointmentNotifyNotOnLimit(AppointmentCustomerView appointment) { |
| | | private boolean isAppointmentExpiringNotifyNotOnLimit(AppointmentCustomerView appointment) { |
| | | int sendNotifyToCustomerRecordSum = |
| | | appointmentExpiringNotifyRecordRepository.findAllByAppointmentId(appointment.getId()).size(); |
| | | |
| | | return sendNotifyToCustomerRecordSum < Constants.SEND_EXPIRING_NOTIFY_LIMIT; |
| | | } |
| | | |
| | | private String getAppointmentUrl(Long appointmentId) { |
| | | private String getAppointmentExpiringNotifyUrl(Long appointmentId) { |
| | | return applicationProperties.getFrontEndDomain() + "?notContactAppointmentId=" + appointmentId; |
| | | } |
| | | |