From 3c94dc06c3b99e7fc430e68ee2ce4a6cf2cd422c Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期三, 16 二月 2022 15:54:32 +0800
Subject: [PATCH] [update] 修正滿意度評分在沒有撈到任何評分紀錄時,不可直接set 0進顧問的分數中

---
 pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java b/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java
index 6d5ded6..fe55f38 100644
--- a/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java
+++ b/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java
@@ -12,8 +12,8 @@
 import com.pollex.pam.appointment.process.AppointmentProcess;
 import com.pollex.pam.config.ApplicationProperties;
 import com.pollex.pam.config.Constants;
+import com.pollex.pam.enums.SatisfactionTypeEnum;
 import com.pollex.pam.service.dto.*;
-import com.pollex.pam.web.rest.errors.NotFoundExpiringAppointmentException;
 import com.pollex.pam.web.rest.errors.SendEmailFailException;
 import com.pollex.pam.web.rest.errors.SendSMSFailException;
 import io.jsonwebtoken.lang.Assert;
@@ -159,7 +159,7 @@
     }
 
     public void setSatisfactionScore(AppointmentCustomerViewDTO dto, Long appointmentId) {
-        satisfactionService.getByAppointmentId(appointmentId).ifPresent(satisfaction -> {
+        satisfactionService.getByAppointmentIdAndType(appointmentId, SatisfactionTypeEnum.APPOINTMENT).ifPresent(satisfaction -> {
             dto.setSatisfactionScore(satisfaction.getScore());
         });
     }
@@ -200,7 +200,8 @@
     public void sendAppointmentNotify(Appointment appointment) {
         Assert.notNull(appointment, "appointment entity cannot be null");
 
-        log.debug("is need send appointment notify msg? = {}", applicationProperties.isSendNotifyMsg());
+        log.debug("is need send appointment notify msg? sms = {}, email = {}",
+            applicationProperties.getSms().isSendNotifyMsg(), applicationProperties.getEmail().isSendNotifyMsg());
 
         log.debug("sending appointment notify, appointmentId = {}", appointment.getId());
         sendAppointmentNotifyBySMS(appointment);

--
Gitblit v1.8.0