From 7f5d9074ae2b0e97a9320845d812c4ec1c2d861d Mon Sep 17 00:00:00 2001 From: Jack <jack.su@pollex.com.tw> Date: 星期五, 03 十二月 2021 16:53:13 +0800 Subject: [PATCH] [ADD] 取得滿意度資料的API新增customer name 跟 agent name --- pamapi/src/main/java/com/pollex/pam/service/mapper/SatisfactionMapper.java | 17 ++++++++++++++++- pamapi/src/main/java/com/pollex/pam/service/dto/SatisfactionDTO.java | 23 ++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/pamapi/src/main/java/com/pollex/pam/service/dto/SatisfactionDTO.java b/pamapi/src/main/java/com/pollex/pam/service/dto/SatisfactionDTO.java index e244de1..5a6c4ae 100644 --- a/pamapi/src/main/java/com/pollex/pam/service/dto/SatisfactionDTO.java +++ b/pamapi/src/main/java/com/pollex/pam/service/dto/SatisfactionDTO.java @@ -14,6 +14,9 @@ private SatisfactionStatusEnum status; private Float score; private Long appointmentId; + private String customerName; + private String agentName; + public Long getId() { return id; } @@ -56,6 +59,24 @@ public void setScore(Float score) { this.score = score; } - + public Long getAppointmentId() { + return appointmentId; + } + public void setAppointmentId(Long appointmentId) { + this.appointmentId = appointmentId; + } + public String getCustomerName() { + return customerName; + } + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + public String getAgentName() { + return agentName; + } + public void setAgentName(String agentName) { + this.agentName = agentName; + } + } diff --git a/pamapi/src/main/java/com/pollex/pam/service/mapper/SatisfactionMapper.java b/pamapi/src/main/java/com/pollex/pam/service/mapper/SatisfactionMapper.java index d83505c..97669a7 100644 --- a/pamapi/src/main/java/com/pollex/pam/service/mapper/SatisfactionMapper.java +++ b/pamapi/src/main/java/com/pollex/pam/service/mapper/SatisfactionMapper.java @@ -5,18 +5,33 @@ import java.util.List; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.pollex.pam.domain.Consultant; +import com.pollex.pam.domain.Customer; import com.pollex.pam.domain.Satisfaction; +import com.pollex.pam.repository.ConsultantRepository; +import com.pollex.pam.repository.CustomerRepository; import com.pollex.pam.service.dto.SatisfactionDTO; @Service public class SatisfactionMapper { + @Autowired + ConsultantRepository consultantRepository; + + @Autowired + CustomerRepository customerRepository; + public SatisfactionDTO toDTO(Satisfaction source) { SatisfactionDTO target = new SatisfactionDTO(); - target.setScore(source.getScore()); BeanUtils.copyProperties(source, target); + target.setScore(source.getScore()); + Consultant consultant= consultantRepository.findOneByAgentNo(source.getAgentNo()).get(); + target.setAgentName(consultant.getName()); + Customer customer = customerRepository.findById(source.getCustomerId()).get(); + target.setCustomerName(customer.getName()); return target; } -- Gitblit v1.8.0