From 4b1785f145437033183fdf678e0b21626a86ff96 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期三, 10 十一月 2021 18:01:33 +0800
Subject: [PATCH] Merge branch 'master' of https://192.168.0.10:8443/r/pcalife/PAM

---
 pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java b/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java
index b9fbf53..d26676d 100644
--- a/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java
+++ b/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java
@@ -1,17 +1,24 @@
 package com.pollex.pam.service;
 
+import com.pollex.pam.domain.Appointment;
+import com.pollex.pam.domain.AppointmentCustomerView;
 import com.pollex.pam.domain.Consultant;
 import com.pollex.pam.domain.CustomFavoriteConsultant;
 import com.pollex.pam.domain.User;
 import com.pollex.pam.enums.ContactStatusEnum;
+import com.pollex.pam.repository.AppointmentCustomerViewRepository;
 import com.pollex.pam.repository.ConsultantRepository;
 import com.pollex.pam.repository.CustomFavoriteConsultantRepository;
+import com.pollex.pam.security.SecurityUtils;
 import com.pollex.pam.service.dto.*;
+import com.pollex.pam.service.mapper.AppointmentCustomerViewMapper;
+import com.pollex.pam.service.mapper.AppointmentMapper;
 import com.pollex.pam.service.mapper.ConsultantMapper;
 import com.pollex.pam.web.rest.errors.ConsultantNotFoundException;
 import com.pollex.pam.web.rest.errors.NotLoginException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -22,13 +29,22 @@
 @Service
 public class ConsultantService {
 
-    private final static Logger log = LoggerFactory.getLogger(ConsultantService.class);
+    private static final Logger log = LoggerFactory.getLogger(ConsultantService.class);
 
     private final ConsultantRepository consultantRepository;
     private final CustomFavoriteConsultantRepository customFavoriteConsultantRepository;
     private final ConsultantMapper consultantMapper;
     private final UserService userService;
-
+    
+    @Autowired
+    AppointmentService appointmentService;
+    
+    @Autowired
+    AppointmentCustomerViewRepository appointmentCustomerViewRepository;
+    
+    @Autowired
+    AppointmentCustomerViewMapper appointmentCustomerViewMapper;
+    
     public ConsultantService(
         ConsultantRepository consultantRepository,
         CustomFavoriteConsultantRepository customFavoriteConsultantRepository,
@@ -57,9 +73,10 @@
     }
 
     public List<ConsultantDTO> strictQueryConsultant(StrictQueryConsultantParam param) {
-
-
-        return Collections.emptyList();
+        return consultantRepository.findAll(ConsultantQuerySpec.getStrictQuerySpec(param))
+            .stream()
+            .map(consultantMapper::toDto)
+            .collect(Collectors.toList());
     }
 
     public List<ConsultantDTO> fastQueryConsultant(FastQueryConsultantParam param) {
@@ -92,9 +109,15 @@
                 customFavoriteConsultantRepository.save(customFavoriteConsultant);
             }
             else {
-                log.info("The consultant is in custom favorite list!");
+                log.info("The consultant is in custom favorite list! customId = {}, consultant AgentNo = {}", user.getId(), consultant.getAgentNo());
             }
         });
 
     }
+
+	public List<AppointmentCustomerViewDTO> getMyAppointment() {
+		String agentNo = SecurityUtils.getAgentNo();
+		List<AppointmentCustomerView> appointmentList = appointmentCustomerViewRepository.findByAgentNo(agentNo);
+		return appointmentCustomerViewMapper.toAppointmentCustomerViewDTO(appointmentList);
+	}
 }

--
Gitblit v1.8.0