From d83d50b60935ad24730488c23e996b651647c295 Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期一, 24 一月 2022 11:19:28 +0800 Subject: [PATCH] [update] 修正客戶若沒有未處理預約單時,改回null而非404 --- pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java | 34 ++++++++++++++++++++-------------- 1 files changed, 20 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..0179b54 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); @@ -248,7 +250,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 +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); @@ -298,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()) @@ -310,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(); } } -- Gitblit v1.8.0