@Transactional public Chat postImage(int userId, String picture) { Chat result = null; Chat chat = new Chat(); User user = (User) userDao.findOne(userId); chat.setUser(user); chat.setPicture(picture); chat.setSendTime(LocalDateTime.now(ZoneId.of("UTC+8"))); result = chatDao.save(chat); return result; }
@Transactional public Chat postChat(int userId, String messages, String picture, Character showUserInfo) { Chat result = null; Chat chat = new Chat(); User user = (User) userDao.findOne(userId); chat.setMessages(messages); chat.setShowUserInfo(showUserInfo); chat.setUser(user); chat.setPicture(picture); chat.setSendTime(LocalDateTime.now(ZoneId.of("UTC+8"))); result = chatDao.save(chat); return result; }