From 34b07249c7e7a9f487a6bc08f022db6bcb925d42 Mon Sep 17 00:00:00 2001
From: Jack <jack.su@pollex.com.tw>
Date: 星期四, 20 一月 2022 14:46:35 +0800
Subject: [PATCH] [UPDATE] 調整客戶填寫滿意度的API [UPDATE] 調整產生滿意度調查資料的時機點,改為每次進到結案狀態就新增滿意度資料 [UPDATE] 調整結案API,新增和修改都使用同一支API由後端判斷為新增或修改 [BUG] 當沒有任何一筆滿意度的時候取得顧問平均分數會發生錯誤的問題修正

---
 pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentCustomerViewMapper.java |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 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 823d73b..1821d25 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,13 +3,19 @@
 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;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+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;
 import com.pollex.pam.service.dto.AppointmentCustomerViewDTO;
 
@@ -19,12 +25,26 @@
 	@Autowired
 	AppointmentService appointmentService;
 	
+	@Autowired
+	AppointmentNoticeLogService appointmentNoticeLogService;
+	
+	@Autowired
+	AppointmentClosedInfoRepository appointmentClosedInfoRepository;
+	
 	@Transactional
 	public AppointmentCustomerViewDTO toAppointmentCustomerViewDTO(AppointmentCustomerView source) {
 		AppointmentCustomerViewDTO target = new AppointmentCustomerViewDTO();
 		BeanUtils.copyProperties(source, target);
 		target.setAppointmentMemoList(source.getAppointmentMemoList());
 		appointmentService.setInterviewRecordDTO(target);
+		List<AppointmentNoticeLog> noticeLogs = appointmentNoticeLogService.findByAppointmentId(source.getId());
+		target.setAppointmentNoticeLogs(noticeLogs);
+		Optional<AppointmentClosedInfo> appointmentClosedInfoOP = appointmentClosedInfoRepository
+				.findByAppointmentId(source.getId());
+		if(appointmentClosedInfoOP.isPresent()) {
+			target.setAppointmentClosedInfo(appointmentClosedInfoOP.get());
+		}
+		
 		return target;
 	}
 

--
Gitblit v1.8.0