Commit 181ebe40 by Lee Munkyeong

ルーム情報更新前にデータクリア

parent ca1b03fd
...@@ -50,16 +50,21 @@ public class RoomListJSON extends AcmsCommonJSON { ...@@ -50,16 +50,21 @@ public class RoomListJSON extends AcmsCommonJSON {
chatRoomDto.chatRoomId = roomListJsonArray.getJSONObject(listCount).getInt(RoomId); chatRoomDto.chatRoomId = roomListJsonArray.getJSONObject(listCount).getInt(RoomId);
chatRoomDto.chatRoomName = roomListJsonArray.getJSONObject(listCount).getString(RoomName); chatRoomDto.chatRoomName = roomListJsonArray.getJSONObject(listCount).getString(RoomName);
chatRoomDto.type = roomListJsonArray.getJSONObject(listCount).getInt(RoomType); chatRoomDto.type = roomListJsonArray.getJSONObject(listCount).getInt(RoomType);
chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).getInt(UnreadCount); chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).has(UnreadCount) ? roomListJsonArray.getJSONObject(listCount).getInt(UnreadCount) : 0;
chatRoomDto.userCount = roomListJsonArray.getJSONObject(listCount).getJSONArray(AttendUsers).length(); chatRoomDto.userCount = roomListJsonArray.getJSONObject(listCount).getJSONArray(AttendUsers).length();
//最後メッセージ情報がある場合の処理 //最後メッセージ情報がある場合の処理
JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).getJSONObject(LastMessageInfo); JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).has(LastMessageInfo) ? roomListJsonArray.getJSONObject(listCount).getJSONObject(LastMessageInfo) : null;
if (lastMessageInfoJSON != null) { if (lastMessageInfoJSON != null) {
chatMessageDto.chatRoomId = chatRoomDto.chatRoomId; chatMessageDto.chatRoomId = chatRoomDto.chatRoomId;
chatMessageDto.message = lastMessageInfoJSON.getString(Message); chatMessageDto.message = lastMessageInfoJSON.getString(Message);
chatMessageDto.messageType = lastMessageInfoJSON.getInt(MessageType); chatMessageDto.messageType = lastMessageInfoJSON.getInt(MessageType);
lastMessageInfoJSON.getJSONObject(MessageInsertDate);
//TODO Change InsertDate Type
chatMessageDto.insertDate = lastMessageInfoJSON.getString(MessageInsertDate); chatMessageDto.insertDate = lastMessageInfoJSON.getString(MessageInsertDate);
chatMessageDto.shopMemberId = lastMessageInfoJSON.getInt(ShopMemberId); chatMessageDto.shopMemberId = lastMessageInfoJSON.getInt(ShopMemberId);
chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(MessageId); chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(MessageId);
chatRoomDto.lastMessageInfo = chatMessageDto; chatRoomDto.lastMessageInfo = chatMessageDto;
......
...@@ -105,6 +105,8 @@ public class ChatRoomDao extends AbstractDao { ...@@ -105,6 +105,8 @@ public class ChatRoomDao extends AbstractDao {
try { try {
beginTransaction(); beginTransaction();
delete("t_chat_room", null, null); delete("t_chat_room", null, null);
delete("r_chat_room_shop_member", null, null);
delete("t_chat_message", null, null);
commit(); commit();
} catch (Exception e) { } catch (Exception e) {
rollback(); rollback();
......
...@@ -91,4 +91,9 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -91,4 +91,9 @@ public class CommunicationLogic extends AbstractLogic {
chatMessageDao.insertChatMessage(chatRoomDto.lastMessageInfo); chatMessageDao.insertChatMessage(chatRoomDto.lastMessageInfo);
} }
} }
public void deleteChatRoomList() {
chatRoomDao.deleteChatRoom();
}
} }
...@@ -695,6 +695,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -695,6 +695,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
public void updateRoomList() throws NetworkDisconnectedException, AcmsException { public void updateRoomList() throws NetworkDisconnectedException, AcmsException {
Map<String, Object> chatRoomList; Map<String, Object> chatRoomList;
RoomListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoomList(sid); RoomListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoomList(sid);
communicationLogic.deleteChatRoomList();
communicationLogic.insertChatRoomList(resultJson.roomList); communicationLogic.insertChatRoomList(resultJson.roomList);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment