保誠-保戶業務員媒合平台
Jack
2022-01-20 387523be22e05114d850d2e0fe73c368f471e3d7
pamapi/src/main/java/com/pollex/pam/service/mapper/AppointmentCustomerViewMapper.java
@@ -3,6 +3,7 @@
import static java.util.stream.Collectors.toList;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -12,6 +13,7 @@
import com.pollex.pam.domain.AppointmentClosedInfo;
import com.pollex.pam.domain.AppointmentCustomerView;
import com.pollex.pam.domain.AppointmentNoticeLog;
import com.pollex.pam.repository.AppointmentClosedInfoRepository;
import com.pollex.pam.service.AppointmentClosedInfoService;
import com.pollex.pam.service.AppointmentNoticeLogService;
import com.pollex.pam.service.AppointmentService;
@@ -27,7 +29,7 @@
   AppointmentNoticeLogService appointmentNoticeLogService;
   
   @Autowired
   AppointmentClosedInfoService appointmentClosedInfoService;
   AppointmentClosedInfoRepository appointmentClosedInfoRepository;
   
   @Transactional
   public AppointmentCustomerViewDTO toAppointmentCustomerViewDTO(AppointmentCustomerView source) {
@@ -37,8 +39,12 @@
      appointmentService.setInterviewRecordDTO(target);
      List<AppointmentNoticeLog> noticeLogs = appointmentNoticeLogService.findByAppointmentId(source.getId());
      target.setAppointmentNoticeLogs(noticeLogs);
      AppointmentClosedInfo appointmentClosedInfo = appointmentClosedInfoService.findByAppointmentId(source.getId());
      target.setAppointmentClosedInfo(appointmentClosedInfo);
      Optional<AppointmentClosedInfo> appointmentClosedInfoOP = appointmentClosedInfoRepository
            .findByAppointmentId(source.getId());
      if(appointmentClosedInfoOP.isPresent()) {
         target.setAppointmentClosedInfo(appointmentClosedInfoOP.get());
      }
      return target;
   }