From e7ff6eaf7ffd713d102f596b4e5d906504160ff8 Mon Sep 17 00:00:00 2001 From: Jack <jack.su@pollex.com.tw> Date: 星期二, 23 十一月 2021 18:34:23 +0800 Subject: [PATCH] [ADD] 客戶註冊的API --- pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java b/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java index 5932aca..7b0ebfa 100644 --- a/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java +++ b/pamapi/src/main/java/com/pollex/pam/service/AppointmentService.java @@ -22,23 +22,22 @@ @Service @Transactional public class AppointmentService { - + @Autowired AppointmentRepository appointmentRepository; - + @Autowired AppointmentDTOMapper appointmentDTOMapper; - + @Autowired ConsultantService consultantService; - + @Autowired AppointmentCustomerViewMapper appointmentCustomerViewMapper; - + @Autowired AppointmentCustomerViewRepository appointmentCustomerViewRepository; - - + public void customerCreateAppointment(AppointmentCreateDTO appointmentCreateDTO) { Appointment appointment = appointmentDTOMapper.toAppointment(appointmentCreateDTO); appointment.setCustomerId(SecurityUtils.getCustomerId()); @@ -46,14 +45,13 @@ appointmentRepository.save(appointment); } - public List<Appointment> findByAgentNo(String agentNo) { return appointmentRepository.findByAgentNo(agentNo); } public void markAsContacted(Long appointmentId) { - - Appointment appointment = appointmentRepository.getById(appointmentId); + + Appointment appointment = appointmentRepository.findById(appointmentId).get(); appointment.setCommunicateStatus(ContactStatusEnum.CONTACTED); appointmentRepository.save(appointment); } @@ -64,5 +62,9 @@ .orElseThrow(AppointmentNotFoundException::new); return appointmentCustomerViewMapper.toAppointmentCustomerViewDTO(appointment); } - + + + public List<Appointment> findByAgentNoAndCustomerId(String agentNo, Long customerId) { + return appointmentRepository.findByAgentNoAndCustomerId(agentNo, customerId); + } } -- Gitblit v1.8.0