From 3ffa09663819d163579fb90276d372a675c528f0 Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期二, 01 三月 2022 14:09:53 +0800
Subject: [PATCH] [update] [todo 135940] 顧問預約未處理新增導到登入頁網址

---
 pamapi/src/main/java/com/pollex/pam/service/ScheduleTaskService.java |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/service/ScheduleTaskService.java b/pamapi/src/main/java/com/pollex/pam/service/ScheduleTaskService.java
index 57324b5..9faef6e 100644
--- a/pamapi/src/main/java/com/pollex/pam/service/ScheduleTaskService.java
+++ b/pamapi/src/main/java/com/pollex/pam/service/ScheduleTaskService.java
@@ -6,6 +6,7 @@
 import com.pollex.pam.enums.AppointmentStatusEnum;
 import com.pollex.pam.enums.ContactStatusEnum;
 import com.pollex.pam.enums.SatisfactionStatusEnum;
+import com.pollex.pam.enums.SatisfactionTypeEnum;
 import com.pollex.pam.repository.AppointmentCustomerViewRepository;
 import com.pollex.pam.repository.AppointmentExpiringNotifyRecordRepository;
 import org.slf4j.Logger;
@@ -76,10 +77,11 @@
             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);
@@ -127,16 +129,16 @@
 
     // todo ��蝣箄�府����, otis todo=134497
     @Scheduled(cron = "0 30 8 * * *")
-    public void sendNotFillSatisfactionToPersonalNotification() {
-        Map<Long, List<Satisfaction>> customerNotFillSatisfactions = satisfactionService.getByStatus(SatisfactionStatusEnum.UNFILLED)
+    public void sendNotFillAppointmentSatisfactionToPersonalNotification() {
+        Map<Long, List<Satisfaction>> customerNotFillSatisfactions =
+            satisfactionService.getByStatusAndType(SatisfactionStatusEnum.UNFILLED, SatisfactionTypeEnum.APPOINTMENT)
                 .stream()
                 .collect(Collectors.groupingBy(Satisfaction::getCustomerId));
 
         customerNotFillSatisfactions.forEach((customerId, notFillSatisfactions) ->
-            personalNotificationService.createNotFillSatisfactionSumToCustomer(customerId, notFillSatisfactions.size())
+            personalNotificationService.createNotFillAppointmentSatisfactionNumberToCustomer(customerId, notFillSatisfactions.size())
         );
     }
-
     private boolean isAppointmentExpiringNotifyNotOnLimit(AppointmentCustomerView appointment) {
         int sendNotifyToCustomerRecordSum =
             appointmentExpiringNotifyRecordRepository.findAllByAppointmentId(appointment.getId()).size();
@@ -144,13 +146,19 @@
         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);
     }
 

--
Gitblit v1.8.0