保誠-保戶業務員媒合平台
Jack
2021-11-26 6282fdfadbc9f22e3874f206cdd5e67014583991
pamapi/src/main/java/com/pollex/pam/domain/Customer.java
@@ -2,9 +2,12 @@
import java.io.Serializable;
import java.time.Instant;
import java.util.Optional;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@@ -12,8 +15,10 @@
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.util.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.pollex.pam.enums.OtpLoginTypeEnum;
@Entity
@Table(name = "customer")
@@ -37,6 +42,10 @@
   
   @Column(name = "email")
    private String email;
   @Enumerated(value = EnumType.STRING)
   @Column(name = "contact_type")
    private OtpLoginTypeEnum contactType;
   
   @CreatedDate
    @Column(name = "created_date", updatable = false)
@@ -95,7 +104,19 @@
   public void setLastModifiedDate(Instant lastModifiedDate) {
      this.lastModifiedDate = lastModifiedDate;
   }
   public OtpLoginTypeEnum getContactType() {
      return contactType;
   }
   public void setContactType(OtpLoginTypeEnum contactType) {
      this.contactType = contactType;
   }
    
    public String toAccountString() {
       return Optional.ofNullable(getPhone())
            .filter(StringUtils::hasText)
            .orElseGet(this::getEmail);
    }
}