diff --git a/src/main/java/org/ntlab/citrusserver/repositories/BookManager.java b/src/main/java/org/ntlab/citrusserver/repositories/BookManager.java index d19fd96..ecf2664 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/BookManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/BookManager.java @@ -5,6 +5,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -43,7 +45,7 @@ } Account account = accountManager.getAccount(accountId); //アカウントの取得 int newBookId = account.getNewBookId(); //新たに生成されたIdを取得(作成数もここで加算している) - Book book = new Book(accountId, newBookId, title, publicity, color); //本の初期化 + Book book = new Book(accountId, newBookId, title, publicity, color, getDateTime()); //本の初期化 notifyListener(account, book);//公開設定を通知します booksMap.get(accountId).put(newBookId, book); //ブックに追加 return booksMap.get(accountId).get(newBookId); //(int->Bookを返すように変更した) @@ -138,4 +140,12 @@ } + //現在時刻の取得 + private String getDateTime() + { + LocalDateTime nowDate = LocalDateTime.now(); + DateTimeFormatter dtf1 = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm"); + return dtf1.format(nowDate); + } + }