From bdcaac32492b5e6223fef4304f4d86403e877022 Mon Sep 17 00:00:00 2001 From: Jack <jack.su@pollex.com.tw> Date: 星期五, 26 十一月 2021 18:33:11 +0800 Subject: [PATCH] [UPDATE] 調整註冊和OTP登入的流程 --- pamapi/src/main/java/com/pollex/pam/domain/Customer.java | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-) diff --git a/pamapi/src/main/java/com/pollex/pam/domain/Customer.java b/pamapi/src/main/java/com/pollex/pam/domain/Customer.java index 225fba6..359d0a3 100644 --- a/pamapi/src/main/java/com/pollex/pam/domain/Customer.java +++ b/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); + } } -- Gitblit v1.8.0