保誠-保戶業務員媒合平台
wayne
2022-01-26 6fa4bba623713c396432ba8b863846883d6a1906
pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentMapper.java
@@ -5,13 +5,21 @@
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pollex.pam.domain.Appointment;
import com.pollex.pam.domain.Satisfaction;
import com.pollex.pam.enums.SatisfactionStatusEnum;
import com.pollex.pam.repository.AppointmentRepository;
import com.pollex.pam.service.dto.AppointmentDTO;
import com.pollex.pam.service.dto.SatisfactionCustomerScoreDTO;
@Service
public class AppointmentMapper {
   @Autowired
   AppointmentRepository appointmentRepository;
   public AppointmentDTO toAppointmentDTO(Appointment source) {
      AppointmentDTO target = new AppointmentDTO();
@@ -24,4 +32,20 @@
            .map(s -> toAppointmentDTO(s)).collect(toList());
   }
   public Satisfaction toSatisfaction(Appointment appointment) {
      Satisfaction target = new Satisfaction();
        target.setAppointmentId(appointment.getId());
      target.setAgentNo(appointment.getAgentNo());
      target.setCustomerId(appointment.getCustomerId());
      target.setStatus(SatisfactionStatusEnum.UNFILLED);
      return target;
   }
   public Satisfaction toSatisfaction(Long appointmentId) {
      Appointment appointment = appointmentRepository.findById(appointmentId).get();
      return toSatisfaction(appointment);
   }
}