From ae4db5435180c44b37f521c463b17f2023ac1d8c Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期五, 18 二月 2022 09:25:50 +0800
Subject: [PATCH] [update] 若顧問停用時,將無法登入 (文案待確認)

---
 pamapi/src/main/java/com/pollex/pam/web/rest/ConsultantResource.java |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/web/rest/ConsultantResource.java b/pamapi/src/main/java/com/pollex/pam/web/rest/ConsultantResource.java
index d80947c..3af2eaf 100644
--- a/pamapi/src/main/java/com/pollex/pam/web/rest/ConsultantResource.java
+++ b/pamapi/src/main/java/com/pollex/pam/web/rest/ConsultantResource.java
@@ -1,7 +1,9 @@
 package com.pollex.pam.web.rest;
 
+import com.pollex.pam.domain.Appointment;
 import com.pollex.pam.domain.Consultant;
 import com.pollex.pam.security.SecurityUtils;
+import com.pollex.pam.service.AppointmentService;
 import com.pollex.pam.service.ConsultantService;
 import com.pollex.pam.service.dto.*;
 import org.apache.commons.compress.utils.IOUtils;
@@ -27,6 +29,9 @@
 
     @Autowired
     ConsultantService consultantService;
+    
+    @Autowired
+    AppointmentService appointmentService;
 
     @GetMapping("/favorite")
     public ResponseEntity<List<CustomerFavoriteConsultantDTO>> getMyConsultantList() {
@@ -115,4 +120,14 @@
     	Consultant editResult = consultantService.editConsultant(editDTO);
         return new ResponseEntity<>(editResult, HttpStatus.OK);
     }
+    
+    @PostMapping("/sendSatisfactionToClient/{appointmentId}")
+    public ResponseEntity<Void> sendSatisfactionToClient(@PathVariable Long appointmentId) {
+    	Appointment appointment = appointmentService.findById(appointmentId);
+    	if(!appointment.getAgentNo().equals(SecurityUtils.getAgentNo())) {
+    		throw new IllegalAccessError();
+    	}
+    	consultantService.sendSatisfactionToClient(appointment);
+    	return ResponseEntity.noContent().build();
+    }
 }

--
Gitblit v1.8.0