| | |
| | | |
| | | @Autowired |
| | | ApplicationProperties applicationProperty; |
| | | |
| | | |
| | | @Autowired |
| | | SendMsgService sendMsgService; |
| | | |
| | | |
| | | @Autowired |
| | | SpringTemplateEngine springTemplateEngine; |
| | | |
| | | |
| | | @Autowired |
| | | ApplicationProperties applicationProperties; |
| | | |
| | | |
| | | @Autowired |
| | | ConsultantService consultantService; |
| | | |
| | | |
| | | @Autowired |
| | | SatisfactionRepository satisfactionRepository; |
| | | |
| | | @Autowired |
| | | PersonalNotificationService personalNotificationService; |
| | | |
| | | public List<CustomerFavoriteConsultantDTO> getMyConsultantList() { |
| | | Long customerId = SecurityUtils.getCustomerDBId(); |
| | |
| | | dto, |
| | | appointmentService.findAvailableByAgentNoAndCustomerId(consultant.getAgentNo(), customerId) |
| | | ); |
| | | |
| | | |
| | | setFavoriteConsultantUpdatedTime(relation, dto); |
| | | |
| | | return dto; |
| | |
| | | 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); |
| | |
| | | .orElseThrow(ConsultantNotFoundException::new); |
| | | consultantDTOMapper.copyToConsultant(editDTO, consultant); |
| | | FileUtil.base64ToFile(editDTO.getPhotoBase64(), editDTO.getPhotoFileName(), applicationProperty.getFileFolderPath()); |
| | | return consultantRepository.save(consultant); |
| | | consultantRepository.save(consultant); |
| | | personalNotificationService.createEditConsultantToConsultant(consultant); |
| | | return consultant; |
| | | } |
| | | |
| | | public InputStream getAvatarImage(String agentNo) { |
| | |
| | | |
| | | 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); |
| | |
| | | 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()) |
| | |
| | | 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(); |
| | | } |
| | | } |