保誠-保戶業務員媒合平台
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);
      }
   }
}