From 2ad11fa39ac42b17dc1b34b01788322855fa2e3e Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期一, 13 十二月 2021 12:16:11 +0800 Subject: [PATCH] [update] 【todo 132231】修正顧問清單的更新時間在有預約單刪除後應為刪除時間 --- pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 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 01c179e..da2ee4f 100644 --- a/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java +++ b/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java @@ -3,6 +3,7 @@ import com.pollex.pam.domain.AppointmentCustomerView; import com.pollex.pam.domain.Consultant; import com.pollex.pam.domain.CustomerFavoriteConsultant; +import com.pollex.pam.enums.AppointmentStatusEnum; import com.pollex.pam.enums.ContactStatusEnum; import com.pollex.pam.enums.LoginResult; import com.pollex.pam.repository.ConsultantRepository; @@ -61,19 +62,25 @@ dto.setContactStatus(ContactStatusEnum.PICKED); dto.setCreateTime(relation.getCreatedDate()); + dto.setUpdateTime(relation.getLastModifiedDate()); dto.setCustomerViewTime(relation.getViewTime()); - setAppointmentInfo( + setAvaliableAppointmentInfo( dto, appointmentService.findAvailableByAgentNoAndCustomerId(consultant.getAgentNo(), customerId) ); + + appointmentService.findLatestAppointmentByAgentNoAndCustomerId(consultant.getAgentNo(), customerId) + .ifPresent(latestAppointment -> { + dto.setUpdateTime(latestAppointment.getLastModifiedDate()); + }); return dto; }).collect(Collectors.toList()); } - private void setAppointmentInfo(CustomerFavoriteConsultantDTO customerFavoriteConsultantDTO, List<AppointmentCustomerView> appointmentList) { + private void setAvaliableAppointmentInfo(CustomerFavoriteConsultantDTO customerFavoriteConsultantDTO, List<AppointmentCustomerView> appointmentList) { List<AppointmentCustomerView> appointments = appointmentList.stream() .sorted(Comparator.comparing(AppointmentCustomerView::getAppointmentDate).reversed()) .collect(Collectors.toList()); @@ -87,7 +94,6 @@ if (!appointments.isEmpty()) { AppointmentCustomerView latestAppointment = appointments.get(0); customerFavoriteConsultantDTO.setContactStatus(latestAppointment.getCommunicateStatus()); - customerFavoriteConsultantDTO.setUpdateTime(latestAppointment.getLastModifiedDate()); } } -- Gitblit v1.8.0