| | |
| | | |
| | | @Autowired |
| | | CustomerRepository customerRepository; |
| | | |
| | | |
| | | @Autowired |
| | | ConsultantRepository consultantRepository; |
| | | |
| | | |
| | | @Autowired |
| | | ConsultantService consultantService; |
| | | |
| | | @Autowired |
| | | PersonalNotificationService personalNotificationService; |
| | | |
| | | public Satisfaction save(Satisfaction satisfaction) { |
| | | satisfaction = satisfactionRepository.save(satisfaction); |
| | | consultantService.setConsultantAvgScore(satisfaction); |
| | | return satisfaction; |
| | | } |
| | | |
| | | |
| | | public Satisfaction scorefaction(SatisfactionCustomerScoreDTO scoreDTO) { |
| | | Optional<Satisfaction> satisfactionOP = getByAppointmentId(scoreDTO.getAppointmentId()); |
| | | Satisfaction satisfaction = satisfactionOP.orElseThrow(SatisfactionNotFoundException::new); |
| | | satisfaction.setScore(scoreDTO.getScore()); |
| | | satisfaction.setStatus(SatisfactionStatusEnum.FILLED); |
| | | return save(satisfaction); |
| | | save(satisfaction); |
| | | personalNotificationService.createScorefactionToConsultant(satisfaction); |
| | | return satisfaction; |
| | | } |
| | | |
| | | |
| | | public Satisfaction createSatisfaction(Appointment appointment) { |
| | | boolean isexist = getByAppointmentId(appointment.getId()).isPresent(); |
| | | if(isexist) { |
| | |
| | | return satisfactionRepository.findOneByAppointmentId(appointmentId); |
| | | } |
| | | |
| | | public List<Satisfaction> getByStatus(SatisfactionStatusEnum status) { |
| | | return satisfactionRepository.findAllByStatus(status); |
| | | } |
| | | |
| | | public List<Satisfaction> scoreAllfaction(List<SatisfactionCustomerScoreDTO> scoreDTO) { |
| | | List<Satisfaction> satisfactionList = new ArrayList<>(); |
| | | scoreDTO.stream().forEach(dto ->{ |