| | |
| | | |
| | | import com.pollex.pam.domain.Appointment; |
| | | import com.pollex.pam.domain.Consultant; |
| | | import com.pollex.pam.domain.CustomFavoriteConsultant; |
| | | import com.pollex.pam.domain.CustomerFavoriteConsultant; |
| | | import com.pollex.pam.enums.ContactStatusEnum; |
| | | import com.pollex.pam.service.AppointmentService; |
| | | import com.pollex.pam.service.dto.ConsultantDTO; |
| | |
| | | return consultantDTO; |
| | | } |
| | | |
| | | public ConsultantDTO toDto(CustomFavoriteConsultant customFavoriteConsultant) { |
| | | Consultant consultant = customFavoriteConsultant.getConsultant(); |
| | | public ConsultantDTO toDto(CustomerFavoriteConsultant customerFavoriteConsultant) { |
| | | Consultant consultant = customerFavoriteConsultant.getConsultant(); |
| | | ConsultantDTO dto = toDto(consultant); |
| | | |
| | | final Optional<Appointment> latestAppointmentOptional = appointmentService.findByAgentNoAndCustomerId(consultant.getAgentNo(), customFavoriteConsultant.getCustomerId()) |
| | | final Optional<Appointment> latestAppointmentOptional = appointmentService.findByAgentNoAndCustomerId(consultant.getAgentNo(), customerFavoriteConsultant.getCustomerId()) |
| | | .stream() |
| | | .max(Comparator.comparing(Appointment::getAppointmentDate)); |
| | | |
| | |
| | | else { |
| | | dto.setContactStatus(ContactStatusEnum.PICKED); |
| | | dto.setLatestAppointmentId(null); |
| | | dto.setUpdateTime(customFavoriteConsultant.getLastModifiedDate()); |
| | | dto.setUpdateTime(customerFavoriteConsultant.getLastModifiedDate()); |
| | | } |
| | | |
| | | return dto; |