保誠-保戶業務員媒合平台
Tomas
2024-01-17 0632b21db7576e4a223eb4f6ca09b650616222f2
pamapi/src/main/java/com/pollex/pam/web/rest/SatisfactionResource.java
@@ -2,8 +2,9 @@
import java.util.List;
import com.pollex.pam.enums.SatisfactionTypeEnum;
import com.pollex.pam.service.dto.SatisfactionSystemScoreDTO;
import com.pollex.pam.business.aop.logging.audit.AuditLoggingInject;
import com.pollex.pam.business.aop.logging.audit.AuditLoggingType;
import com.pollex.pam.business.enums.SatisfactionTypeEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -14,11 +15,11 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.business.domain.Satisfaction;
import com.pollex.pam.business.security.SecurityUtils;
import com.pollex.pam.business.service.SatisfactionService;
import com.pollex.pam.business.service.dto.SatisfactionCustomerScoreDTO;
import com.pollex.pam.business.service.dto.SatisfactionDTO;
@RestController
@RequestMapping("/api/satisfaction")
@@ -30,12 +31,14 @@
   @Autowired
   SatisfactionService satisfactionService;
    @AuditLoggingInject(type = AuditLoggingType.CUSTOMER_FILL_SATISFACTION)
   @PostMapping("/score")
   public Satisfaction scorefaction(@RequestBody SatisfactionCustomerScoreDTO scoreDTO) {
      return satisfactionService.scorefaction(scoreDTO);
   }
   @PostMapping("/score/all")
    @AuditLoggingInject(type = AuditLoggingType.CUSTOMER_FILL_SATISFACTION)
    @PostMapping("/score/all")
   public List<Satisfaction> scoreAllfaction(@RequestBody List<SatisfactionCustomerScoreDTO> scoreDTO) {
      return satisfactionService.scoreAllfaction(scoreDTO);
   }
@@ -45,14 +48,9 @@
      if(StringUtils.hasText(SecurityUtils.getAgentNo())) {
         return satisfactionService.getByAgentNoAndType(SecurityUtils.getAgentNo(), SatisfactionTypeEnum.APPOINTMENT);
      }else if(SecurityUtils.getCustomerDBId()!=null){
         return satisfactionService.getByCustomerIdAndType(SecurityUtils.getCustomerDBId(), SatisfactionTypeEnum.APPOINTMENT);
         return satisfactionService.getByCustomerId(SecurityUtils.getCustomerDBId());
      }
      log.error("Not has agent code and customer id");
      throw new IllegalArgumentException("Not has agent code and customer id");
   }
    @PostMapping("/system/score")
    public Satisfaction createSystemSatisfaction(@RequestBody SatisfactionSystemScoreDTO scoreDTO) {
        return satisfactionService.createSystemSatisfaction(scoreDTO);
    }
}