保誠-保戶業務員媒合平台
wayne
2021-12-13 1eba1f26f48c10e0350819e0c71ca3de849a0414
[fix] 顧問清單的更新時間需大於將顧問加入我的顧問清單的時間

修改1個檔案
15 ■■■■■ 已變更過的檔案
pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java 15 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java
@@ -3,7 +3,6 @@
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;
@@ -62,10 +61,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 +74,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 +95,8 @@
        customerFavoriteConsultantDTO.setAppointments(appointmentCustomerViewDTOS);
        if (!appointments.isEmpty()) {
            AppointmentCustomerView latestAppointment = appointments.get(0);
            customerFavoriteConsultantDTO.setContactStatus(latestAppointment.getCommunicateStatus());
            AppointmentCustomerView latestAvailableAppointment = appointments.get(0);
            customerFavoriteConsultantDTO.setContactStatus(latestAvailableAppointment.getCommunicateStatus());
        }
    }