From 3fc8398a9da85854e5e95c2c4cca14389d5dd5f8 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期三, 16 二月 2022 15:02:49 +0800
Subject: [PATCH] Fixed#135481 修正[ 顧問管理流程 ] 滿意度 : 顧問把預約單結案後,客戶端的顧問清單會顯示該顧問預約單狀態為「進行預約」正確 , 但是卻顯示「給予滿意度評分」的連結。填寫滿意度後無法送出

---
 pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentCustomerViewMapper.java |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentCustomerViewMapper.java b/pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentCustomerViewMapper.java
index f3bb3fb..4389195 100644
--- a/pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentCustomerViewMapper.java
+++ b/pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentCustomerViewMapper.java
@@ -3,6 +3,7 @@
 import static java.util.stream.Collectors.toList;
 
 import java.util.List;
+import java.util.Optional;
 
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -12,6 +13,7 @@
 import com.pollex.pam.domain.AppointmentClosedInfo;
 import com.pollex.pam.domain.AppointmentCustomerView;
 import com.pollex.pam.domain.AppointmentNoticeLog;
+import com.pollex.pam.repository.AppointmentClosedInfoRepository;
 import com.pollex.pam.service.AppointmentClosedInfoService;
 import com.pollex.pam.service.AppointmentNoticeLogService;
 import com.pollex.pam.service.AppointmentService;
@@ -27,7 +29,7 @@
 	AppointmentNoticeLogService appointmentNoticeLogService;
 	
 	@Autowired
-	AppointmentClosedInfoService appointmentClosedInfoService;
+	AppointmentClosedInfoRepository appointmentClosedInfoRepository;
 	
 	@Transactional
 	public AppointmentCustomerViewDTO toAppointmentCustomerViewDTO(AppointmentCustomerView source) {
@@ -37,8 +39,13 @@
 		appointmentService.setInterviewRecordDTO(target);
 		List<AppointmentNoticeLog> noticeLogs = appointmentNoticeLogService.findByAppointmentId(source.getId());
 		target.setAppointmentNoticeLogs(noticeLogs);
-		AppointmentClosedInfo appointmentClosedInfo = appointmentClosedInfoService.findByAppointmentId(source.getId());
-		target.setAppointmentClosedInfo(appointmentClosedInfo);
+		Optional<AppointmentClosedInfo> appointmentClosedInfoOP = appointmentClosedInfoRepository
+				.findByAppointmentId(source.getId());
+		if(appointmentClosedInfoOP.isPresent()) {
+			target.setAppointmentClosedInfo(appointmentClosedInfoOP.get());
+		}
+		appointmentService.setSatisfactionScore(target, source.getId());
+		
 		return target;
 	}
 

--
Gitblit v1.8.0