From 42567b98b186f219b7a923dc3e6daeb5ffa31cfe Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期五, 17 十二月 2021 15:29:59 +0800 Subject: [PATCH] [add][todo 132507] 新增發送手機簡訊service --- pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java b/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java index da2ee4f..8c109fe 100644 --- a/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java +++ b/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java @@ -25,6 +25,8 @@ import java.util.Objects; import java.util.stream.Collectors; +import static com.pollex.pam.enums.ContactStatusEnum.*; + @Service public class ConsultantService { @@ -62,10 +64,10 @@ dto.setContactStatus(ContactStatusEnum.PICKED); dto.setCreateTime(relation.getCreatedDate()); - dto.setUpdateTime(relation.getLastModifiedDate()); + dto.setUpdateTime(relation.getCreatedDate()); dto.setCustomerViewTime(relation.getViewTime()); - setAvaliableAppointmentInfo( + setAvailableAppointmentInfo( dto, appointmentService.findAvailableByAgentNoAndCustomerId(consultant.getAgentNo(), customerId) ); @@ -75,12 +77,16 @@ dto.setUpdateTime(latestAppointment.getLastModifiedDate()); }); + if(dto.getUpdateTime().isBefore(relation.getCreatedDate())) { + dto.setUpdateTime(relation.getCreatedDate()); + } + return dto; }).collect(Collectors.toList()); } - private void setAvaliableAppointmentInfo(CustomerFavoriteConsultantDTO customerFavoriteConsultantDTO, List<AppointmentCustomerView> appointmentList) { + private void setAvailableAppointmentInfo(CustomerFavoriteConsultantDTO customerFavoriteConsultantDTO, List<AppointmentCustomerView> appointmentList) { List<AppointmentCustomerView> appointments = appointmentList.stream() .sorted(Comparator.comparing(AppointmentCustomerView::getAppointmentDate).reversed()) .collect(Collectors.toList()); @@ -92,8 +98,12 @@ customerFavoriteConsultantDTO.setAppointments(appointmentCustomerViewDTOS); if (!appointments.isEmpty()) { - AppointmentCustomerView latestAppointment = appointments.get(0); - customerFavoriteConsultantDTO.setContactStatus(latestAppointment.getCommunicateStatus()); + AppointmentCustomerView latestAvailableAppointment = appointments.get(0); + + if(latestAvailableAppointment.getCommunicateStatus() == RESERVED) + customerFavoriteConsultantDTO.setContactStatus(RESERVED); + else + customerFavoriteConsultantDTO.setContactStatus(PICKED); } } -- Gitblit v1.8.0