From f5831acafe510f9a79f8e2ecf6dee09026d67fc6 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 20 一月 2022 16:09:09 +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/AppointmentService.java | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 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 0af06b9..8cc1a69 100644 --- a/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java +++ b/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java @@ -6,14 +6,18 @@ import java.util.Optional; import java.util.stream.Collectors; +import com.pollex.pam.appointment.process.AppointmentProcess; import com.pollex.pam.config.ApplicationProperties; import com.pollex.pam.service.dto.AppointmentUpdateDTO; +import com.pollex.pam.service.dto.ClosedProcessDTO; +import com.pollex.pam.service.dto.DoneProcessDTO; import com.pollex.pam.service.dto.InterviewRecordDTO; import com.pollex.pam.web.rest.errors.SendEmailFailException; import com.pollex.pam.web.rest.errors.SendSMSFailException; import io.jsonwebtoken.lang.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -26,6 +30,7 @@ import com.pollex.pam.repository.AppointmentCustomerViewRepository; import com.pollex.pam.repository.AppointmentRepository; import com.pollex.pam.security.SecurityUtils; +import com.pollex.pam.service.dto.AppointmentCloseDTO; import com.pollex.pam.service.dto.AppointmentCreateDTO; import com.pollex.pam.service.dto.AppointmentCustomerViewDTO; import com.pollex.pam.service.mapper.AppointmentCustomerViewMapper; @@ -75,6 +80,9 @@ @Autowired InterviewRecordService interviewRecordService; + + @Autowired + AppointmentProcess abstractAppointmentProcess; public Appointment customerCreateAppointment(AppointmentCreateDTO appointmentCreateDTO) { Appointment appointment = appointmentDTOMapper.toAppointment(appointmentCreateDTO); @@ -142,7 +150,6 @@ .map(appointmentCustomerView -> { AppointmentCustomerViewDTO dto = appointmentCustomerViewMapper.toAppointmentCustomerViewDTO(appointmentCustomerView); setSatisfactionScore(dto, appointmentCustomerView.getId()); - return dto; }) .collect(Collectors.toList()); @@ -261,4 +268,16 @@ return appointmentRepository.findById(id) .orElseThrow(AppointmentNotFoundException::new); } + + public void closeAppointment(AppointmentCloseDTO closeDTO) { + if(closeDTO.getContactStatus() == ContactStatusEnum.DONE) { + DoneProcessDTO dto = new DoneProcessDTO(); + BeanUtils.copyProperties(closeDTO, dto); + abstractAppointmentProcess.process(dto); + }else if(closeDTO.getContactStatus() == ContactStatusEnum.CLOSED){ + ClosedProcessDTO dto = new ClosedProcessDTO(); + BeanUtils.copyProperties(closeDTO, dto); + abstractAppointmentProcess.process(dto); + } + } } -- Gitblit v1.8.0