保誠-保戶業務員媒合平台
wayne
2022-01-22 e2fd08cfedded28d1679a4e3bcb4213e965be756
[bug] [todo 134617] 修正預約單在我的顧問清單狀態

修改1個檔案
29 ■■■■ 已變更過的檔案
pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java 29 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java
@@ -73,22 +73,22 @@
    @Autowired
    ApplicationProperties applicationProperty;
    @Autowired
    SendMsgService sendMsgService;
    @Autowired
    SpringTemplateEngine springTemplateEngine;
    @Autowired
    ApplicationProperties applicationProperties;
    @Autowired
    ConsultantService consultantService;
    @Autowired
    SatisfactionRepository satisfactionRepository;
    @Autowired
    PersonalNotificationService personalNotificationService;
@@ -108,7 +108,7 @@
                    dto,
                    appointmentService.findAvailableByAgentNoAndCustomerId(consultant.getAgentNo(), customerId)
                );
                setFavoriteConsultantUpdatedTime(relation, dto);
                return dto;
@@ -140,8 +140,7 @@
        if (!appointments.isEmpty()) {
            AppointmentCustomerView latestAvailableAppointment = appointments.get(0);
            ContactStatusEnum latestStatus = latestAvailableAppointment.getCommunicateStatus();
            if( latestStatus != ContactStatusEnum.DONE
                    || latestStatus != ContactStatusEnum.CLOSED)
            if(latestStatus != ContactStatusEnum.DONE && latestStatus != ContactStatusEnum.CLOSED)
                customerFavoriteConsultantDTO.setContactStatus(latestStatus);
            else
                customerFavoriteConsultantDTO.setContactStatus(PICKED);
@@ -271,19 +270,19 @@
    public void sendSatisfactionToClient(Appointment appointment) {
        String subject = "滿意度填寫通知";
        if(StringUtils.hasText(appointment.getEmail())) {
            String content = genSendSatisfactionEmailContent(appointment);
            sendMsgService.sendMsgByEmail(appointment.getEmail(), subject, content, true);
        }if(StringUtils.hasText(appointment.getPhone())) {
            String content = genSendSatisfactionSMSContent(appointment);
            sendMsgService.sendMsgBySMS(appointment.getPhone(), content);
        }
        personalNotificationService.createSendSatisfactionToClientToCustomer(appointment);
    }
    private String genSendSatisfactionSMSContent(Appointment appointment) {
        String agentNo = appointment.getAgentNo();
        Consultant consultant = consultantService.findByAgentNo(agentNo);
@@ -305,7 +304,7 @@
    public String getSendSatisfactionToClientUrl(Long appointmentId) {
        return applicationProperties.getFrontEndDomain() + "/?appointmentId=" + appointmentId;
    }
    public void setConsultantAvgScore(Satisfaction satisfaction) {
        float avgScore = getAgentAvgScore(satisfaction.getAgentNo());
        Consultant consultant = consultantRepository.findOneByAgentNo(satisfaction.getAgentNo())
@@ -317,7 +316,7 @@
    public float getAgentAvgScore(String agentNo) {
        Float avgScore = satisfactionRepository.getAgentScoreAvg(agentNo);
        if(avgScore==null)return 0;
        BigDecimal bigDecimal = new BigDecimal(avgScore);
        BigDecimal bigDecimal = new BigDecimal(avgScore);
        return avgScore = bigDecimal.setScale(1,BigDecimal.ROUND_HALF_UP).floatValue();
    }
}