From 0d8cc04b812cfa0f15bf8ba12b5fdcbe411f90cd Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期四, 10 二月 2022 16:07:02 +0800
Subject: [PATCH] Merge branch 'Phase3' of https://dev.pollex.com.tw:8443/r/pcalife/PAM into Phase3

---
 pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentMapper.java |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentMapper.java b/pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentMapper.java
index 7b9e398..5526738 100644
--- a/pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentMapper.java
+++ b/pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentMapper.java
@@ -4,14 +4,22 @@
 
 import java.util.List;
 
+import com.pollex.pam.enums.SatisfactionTypeEnum;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.pollex.pam.domain.Appointment;
+import com.pollex.pam.domain.Satisfaction;
+import com.pollex.pam.enums.SatisfactionStatusEnum;
+import com.pollex.pam.repository.AppointmentRepository;
 import com.pollex.pam.service.dto.AppointmentDTO;
 
 @Service
 public class AppointmentMapper {
+
+	@Autowired
+	AppointmentRepository appointmentRepository;
 
 	public AppointmentDTO toAppointmentDTO(Appointment source) {
 		AppointmentDTO target = new AppointmentDTO();
@@ -24,4 +32,21 @@
 				.map(s -> toAppointmentDTO(s)).collect(toList());
 	}
 
+	public Satisfaction toAppointmentSatisfaction(Appointment appointment) {
+		Satisfaction target = new Satisfaction();
+        target.setAppointmentId(appointment.getId());
+		target.setAgentNo(appointment.getAgentNo());
+		target.setCustomerId(appointment.getCustomerId());
+        target.setType(SatisfactionTypeEnum.APPOINTMENT);
+		target.setStatus(SatisfactionStatusEnum.UNFILLED);
+		return target;
+	}
+
+	public Satisfaction toAppointmentSatisfaction(Long appointmentId) {
+		Appointment appointment = appointmentRepository.findById(appointmentId).get();
+		return toAppointmentSatisfaction(appointment);
+	}
+
+
+
 }

--
Gitblit v1.8.0