From 14cce37a73c17683517414687bf76be18b7ee819 Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期四, 24 二月 2022 12:25:16 +0800
Subject: [PATCH] [update] 若加入顧問清單時未帶入createdTime,則帶入目前時間

---
 pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java b/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java
index 30c4f53..fadb2af 100644
--- a/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java
+++ b/pamapi/src/main/java/com/pollex/pam/service/ConsultantService.java
@@ -236,7 +236,9 @@
 
             if(!isConsultantInList) {
                 CustomerFavoriteConsultant customerFavoriteConsultant = new CustomerFavoriteConsultant();
-                customerFavoriteConsultant.setCreatedDate(addConsultantData.getCreatedTime());
+                Optional<Instant> createdTime = Optional.ofNullable(addConsultantData.getCreatedTime());
+
+                customerFavoriteConsultant.setCreatedDate(createdTime.orElse(Instant.now()));
                 customerFavoriteConsultant.setConsultant(consultant);
                 customerFavoriteConsultant.setCustomerId(userId);
 

--
Gitblit v1.8.0