package com.pollex.pam.web.rest; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.pollex.pam.domain.Appointment; import com.pollex.pam.domain.Satisfaction; import com.pollex.pam.security.SecurityUtils; import com.pollex.pam.service.SatisfactionService; import com.pollex.pam.service.dto.SatisfactionCustomerScoreDTO; import com.pollex.pam.service.dto.SatisfactionDTO; import com.pollex.pam.service.dto.SatisfactionUpdateDTO; @RestController @RequestMapping("/api/satisfaction") public class SatisfactionResource { private final Logger log = LoggerFactory.getLogger(SatisfactionResource.class); @Autowired SatisfactionService satisfactionService; @PostMapping("/score") public Satisfaction scorefaction(@RequestBody SatisfactionCustomerScoreDTO scoreDTO) { return satisfactionService.scorefaction(scoreDTO); } @PostMapping("/score/all") public List scoreAllfaction(@RequestBody List scoreDTO) { return satisfactionService.scoreAllfaction(scoreDTO); } @GetMapping("/getMySatisfaction") public List getMySatisfaction(){ if(StringUtils.hasText(SecurityUtils.getAgentNo())) { return satisfactionService.getByAgentNo(SecurityUtils.getAgentNo()); }else if(SecurityUtils.getCustomerDBId()!=null){ return satisfactionService.getByCustomerId(SecurityUtils.getCustomerDBId()); } log.error("Not has agent code and customer id"); throw new IllegalArgumentException("Not has agent code and customer id"); } }