保誠-保戶業務員媒合平台
Jack
2022-01-19 bf5a163bd84dfabb4fab275f6cbd27e5b0747e74
pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentCustomerViewMapper.java
@@ -5,20 +5,40 @@
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.pollex.pam.domain.AppointmentClosedInfo;
import com.pollex.pam.domain.AppointmentCustomerView;
import com.pollex.pam.domain.AppointmentNoticeLog;
import com.pollex.pam.service.AppointmentClosedInfoService;
import com.pollex.pam.service.AppointmentNoticeLogService;
import com.pollex.pam.service.AppointmentService;
import com.pollex.pam.service.dto.AppointmentCustomerViewDTO;
@Service
public class AppointmentCustomerViewMapper {
   @Autowired
   AppointmentService appointmentService;
   @Autowired
   AppointmentNoticeLogService appointmentNoticeLogService;
   @Autowired
   AppointmentClosedInfoService appointmentClosedInfoService;
   
   @Transactional
   public AppointmentCustomerViewDTO toAppointmentCustomerViewDTO(AppointmentCustomerView source) {
      AppointmentCustomerViewDTO target = new AppointmentCustomerViewDTO();
      BeanUtils.copyProperties(source, target);
      target.setAppointmentMemoList(source.getAppointmentMemoList());
      appointmentService.setInterviewRecordDTO(target);
      List<AppointmentNoticeLog> noticeLogs = appointmentNoticeLogService.findByAppointmentId(source.getId());
      target.setAppointmentNoticeLogs(noticeLogs);
      AppointmentClosedInfo appointmentClosedInfo = appointmentClosedInfoService.findByAppointmentId(source.getId());
      target.setAppointmentClosedInfo(appointmentClosedInfo);
      return target;
   }