From 07bac4d672fecac8fd3a316323482b4fcdc48f5d Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期二, 08 二月 2022 14:58:25 +0800 Subject: [PATCH] [update] 預約成功時,回給前端預約單的資訊 --- pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java | 43 +++++++++++++++++++++++++++++-------------- 1 files changed, 29 insertions(+), 14 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 91e1ba3..d5ef36e 100644 --- a/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java +++ b/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java @@ -73,21 +73,24 @@ @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(); @@ -105,7 +108,7 @@ dto, appointmentService.findAvailableByAgentNoAndCustomerId(consultant.getAgentNo(), customerId) ); - + setFavoriteConsultantUpdatedTime(relation, dto); return dto; @@ -137,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); @@ -154,6 +156,14 @@ .collect(Collectors.toList()); } + public List<ConsultantDTO> getAllConsultantList() { + return consultantRepository.findAll() + .stream() + .map(consultantMapper::toDto) + .collect(Collectors.toList()); + } + + @Deprecated public List<ConsultantDTO> strictQueryConsultant(StrictQueryConsultantParam param) { return consultantRepository.findAll(ConsultantQuerySpec.getStrictQuerySpec(param)) .stream() @@ -161,6 +171,7 @@ .collect(Collectors.toList()); } + @Deprecated public List<ConsultantDTO> fastQueryConsultant(FastQueryConsultantParam param) { return consultantRepository.findAll(ConsultantQuerySpec.getFastQuerySpec(param)) .stream() @@ -248,7 +259,9 @@ .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) { @@ -266,17 +279,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); @@ -298,7 +313,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()) @@ -310,7 +325,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(); } } -- Gitblit v1.8.0