保誠-保戶業務員媒合平台
wayne
2022-02-17 a3716f72066d25d745f4d5103ff23a553c3e102b
pamapi/src/main/java/com/pollex/pam/service/mapper/SatisfactionMapper.java
@@ -3,6 +3,7 @@
import static java.util.stream.Collectors.toList;
import java.util.List;
import java.util.Objects;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,8 +29,8 @@
      SatisfactionDTO target = new SatisfactionDTO();
      BeanUtils.copyProperties(source, target);
      target.setScore(source.getScore());
      Consultant consultant= consultantRepository.findOneByAgentNo(source.getAgentNo()).get();
      target.setAgentName(consultant.getName());
      Consultant consultant= consultantRepository.findOneByAgentNo(source.getAgentNo()).orElse(null);
      target.setAgentName(Objects.isNull(consultant) ? null : consultant.getName());
      Customer customer = customerRepository.findById(source.getCustomerId()).get();
      target.setCustomerName(customer.getName());
      return target;