| | |
| | | package com.pollex.pam.appointment.process; |
| | | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.pollex.pam.domain.Appointment; |
| | | import com.pollex.pam.domain.AppointmentClosedInfo; |
| | | import com.pollex.pam.repository.AppointmentClosedInfoRepository; |
| | | import com.pollex.pam.repository.AppointmentRepository; |
| | | import com.pollex.pam.service.AppointmentClosedInfoService; |
| | | import com.pollex.pam.service.AppointmentService; |
| | | import com.pollex.pam.service.dto.AbstractAppointmentProcessDTO; |
| | | |
| | | @Service |
| | |
| | | @Autowired |
| | | List<AppointmentProcessInterface> processList; |
| | | |
| | | @Autowired |
| | | AppointmentService appointmentService; |
| | | |
| | | @Autowired |
| | | AppointmentRepository appointmentRepository; |
| | | |
| | | @Autowired |
| | | AppointmentClosedInfoRepository appointmentClosedInfoRepository; |
| | | |
| | | public void process(AbstractAppointmentProcessDTO dto) { |
| | | |
| | | AbstractAppointmentProcessDTO appointmentProcessDTO = (AbstractAppointmentProcessDTO)dto; |
| | | processList.stream().forEach(process ->{ |
| | | if(process.getProcessType() == appointmentProcessDTO.getContactStatus()) { |
| | | process.doProcess(appointmentProcessDTO); |
| | | } |
| | | }); |
| | | Appointment appointment = appointmentService.findById(dto.getAppointmentId()); |
| | | appointment.setCommunicateStatus(dto.getContactStatus()); |
| | | appointmentRepository.save(appointment); |
| | | } |
| | | |
| | | } |