Commit ec9b0c65 by Lee Munkyeong

コードレビューコメント対応。

parent 1d61462f
...@@ -5,6 +5,7 @@ import org.json.adf.JSONObject; ...@@ -5,6 +5,7 @@ import org.json.adf.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException; import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException; import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto; import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
...@@ -14,20 +15,9 @@ import jp.agentec.abook.abv.bl.dto.ShopMemberDto; ...@@ -14,20 +15,9 @@ import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
public class GroupListJSON extends AcmsCommonJSON { public class GroupListJSON extends AcmsCommonJSON {
private static final String Body = "body";
private static final String GROUP_INFO_LIST = "groupInfoList";
private static final String GROUP_ID = "groupId";
private static final String GROUP_NAME = "groupName";
private static final String PARENT_GROUP_ID = "parentGroupId";
private static final String DEL_FLG = "delFlg";
private static final String GROUP_MEMBER_LIST = "groupMemberList";
private static final String SHOP_MEMBER_ID = "shopMemberId";
private static final String MEMBER_NAME = "memberName";
private static final String PROFILE_IMAGE_PATH = "profileImagePath";
public ArrayList<GroupDto> groupList;
public ArrayList<GroupDto> groupList;
public GroupListJSON(String jsonString) throws AcmsException { public GroupListJSON(String jsonString) throws AcmsException {
super(jsonString); super(jsonString);
...@@ -37,9 +27,9 @@ public class GroupListJSON extends AcmsCommonJSON { ...@@ -37,9 +27,9 @@ public class GroupListJSON extends AcmsCommonJSON {
protected void parse(JSONObject json) throws JSONValidationException { protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得 // ルーム一覧情報を取得
if (!json.has(Body)) { return; } if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONArray groupListJsonArray = json.getJSONObject(Body).getJSONArray(GROUP_INFO_LIST); JSONArray groupListJsonArray = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONArray(ABookCommConstants.KEY.GROUP_INFO_LIST);
if (groupListJsonArray == null) { return; } if (groupListJsonArray == null) { return; }
groupList = new ArrayList<GroupDto>(); groupList = new ArrayList<GroupDto>();
...@@ -47,24 +37,27 @@ public class GroupListJSON extends AcmsCommonJSON { ...@@ -47,24 +37,27 @@ public class GroupListJSON extends AcmsCommonJSON {
if (groupListJsonArray.getJSONObject(listCount).length() == 0) { if (groupListJsonArray.getJSONObject(listCount).length() == 0) {
break; break;
} }
JSONObject groupJSON = groupListJsonArray.getJSONObject(listCount);
GroupDto groupDto = new GroupDto(); GroupDto groupDto = new GroupDto();
groupDto.groupId = groupListJsonArray.getJSONObject(listCount).getInt(GROUP_ID); groupDto.groupId = groupJSON.getInt(ABookCommConstants.KEY.GROUP_ID);
if (groupListJsonArray.getJSONObject(listCount).has(PARENT_GROUP_ID)) { if (groupJSON.has(ABookCommConstants.KEY.PARENT_GROUP_ID)) {
groupDto.parentGroupId = groupListJsonArray.getJSONObject(listCount).getInt(PARENT_GROUP_ID); groupDto.parentGroupId = groupJSON.getInt(ABookCommConstants.KEY.PARENT_GROUP_ID);
} }
groupDto.groupName = groupListJsonArray.getJSONObject(listCount).getString(GROUP_NAME); groupDto.groupName = groupJSON.getString(ABookCommConstants.KEY.GROUP_NAME);
groupDto.delFlg = groupListJsonArray.getJSONObject(listCount).getInt(DEL_FLG); groupDto.delFlg = groupJSON.getInt(ABookCommConstants.KEY.DEL_FLG);
if (groupListJsonArray.getJSONObject(listCount).has(GROUP_MEMBER_LIST)) { if (groupJSON.has(ABookCommConstants.KEY.GROUP_MEMBER_LIST)) {
JSONArray groupMemberJsonArray = groupListJsonArray.getJSONObject(listCount).getJSONArray(GROUP_MEMBER_LIST); JSONArray groupMemberJsonArray = groupJSON.getJSONArray(ABookCommConstants.KEY.GROUP_MEMBER_LIST);
ArrayList<ShopMemberDto> groupMembers = new ArrayList<ShopMemberDto>(); ArrayList<ShopMemberDto> groupMembers = new ArrayList<ShopMemberDto>();
for (int groupMemberCount = 0; groupMemberCount < groupMemberJsonArray.length(); groupMemberCount++) { for (int groupMemberCount = 0; groupMemberCount < groupMemberJsonArray.length(); groupMemberCount++) {
JSONObject groupMember = groupMemberJsonArray.getJSONObject(groupMemberCount);
ShopMemberDto shopMemberDto = new ShopMemberDto(); ShopMemberDto shopMemberDto = new ShopMemberDto();
shopMemberDto.shopMemberId = groupMemberJsonArray.getJSONObject(groupMemberCount).getInt(SHOP_MEMBER_ID); shopMemberDto.shopMemberId = groupMember.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
shopMemberDto.shopMemberName = groupMemberJsonArray.getJSONObject(groupMemberCount).getString(MEMBER_NAME); shopMemberDto.shopMemberName = groupMember.getString(ABookCommConstants.KEY.MEMBER_NAME);
if (groupMemberJsonArray.getJSONObject(groupMemberCount).has(PROFILE_IMAGE_PATH)) { if (groupMember.has(ABookCommConstants.KEY.PROFILE_IMAGE_PATH)) {
shopMemberDto.profileUrl = groupMemberJsonArray.getJSONObject(groupMemberCount).getString(PROFILE_IMAGE_PATH); shopMemberDto.profileUrl = groupMember.getString(ABookCommConstants.KEY.PROFILE_IMAGE_PATH);
} }
ArrayList groupIds = new ArrayList(); ArrayList groupIds = new ArrayList();
groupIds.add(groupDto.groupId); groupIds.add(groupDto.groupId);
......
...@@ -6,6 +6,7 @@ import org.json.adf.JSONObject; ...@@ -6,6 +6,7 @@ import org.json.adf.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException; import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException; import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto; import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
...@@ -13,17 +14,7 @@ import jp.agentec.abook.abv.bl.dto.ShopMemberDto; ...@@ -13,17 +14,7 @@ import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
public class MessageInfoListJSON extends AcmsCommonJSON { public class MessageInfoListJSON extends AcmsCommonJSON {
private static final String Body = "body";
private static final String MESSAGE_INFO_LIST = "messageInfoList";
private static final String MESSAGE = "message";
private static final String MESSAGE_ID = "messageId";
private static final String SHOP_ID = "shopId";
private static final String SHOP_MEMBER_ID = "shopMemberId";
private static final String MESSAGE_TYPE = "messageType";
private static final String TIME = "time";
private static final String MEMBER_NAME = "memberName";
private static final String PROFILE_IMAGE_PATH = "profileImagePath";
public ArrayList<ChatMessageDto> chatMessageDtoArrayList; public ArrayList<ChatMessageDto> chatMessageDtoArrayList;
public ArrayList<ShopMemberDto> shopMemberDtoArrayList; public ArrayList<ShopMemberDto> shopMemberDtoArrayList;
...@@ -36,9 +27,9 @@ public class MessageInfoListJSON extends AcmsCommonJSON { ...@@ -36,9 +27,9 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
protected void parse(JSONObject json) throws JSONValidationException { protected void parse(JSONObject json) throws JSONValidationException {
// メッセージ情報を取得 // メッセージ情報を取得
if (!json.has(Body)) { return; } if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
HashMap<Integer, Integer> existShopMmeberMap = new HashMap<Integer, Integer>(); HashMap<Integer, Integer> existShopMmeberMap = new HashMap<Integer, Integer>();
JSONArray messageInfoList = json.getJSONObject(Body).getJSONArray(MESSAGE_INFO_LIST); JSONArray messageInfoList = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONArray(ABookCommConstants.KEY.MESSAGE_INFO_LIST);
if (messageInfoList == null) { return; } if (messageInfoList == null) { return; }
chatMessageDtoArrayList = new ArrayList<ChatMessageDto>(); chatMessageDtoArrayList = new ArrayList<ChatMessageDto>();
...@@ -53,22 +44,22 @@ public class MessageInfoListJSON extends AcmsCommonJSON { ...@@ -53,22 +44,22 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
JSONObject messageInfoJSON = messageInfoList.getJSONObject(listCount); JSONObject messageInfoJSON = messageInfoList.getJSONObject(listCount);
if (messageInfoJSON == null) { continue; } if (messageInfoJSON == null) { continue; }
chatMessageDto.shopMemberId = messageInfoJSON.getInt(SHOP_MEMBER_ID); chatMessageDto.shopMemberId = messageInfoJSON.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
chatMessageDto.chatMessageId = messageInfoJSON.getInt(MESSAGE_ID); chatMessageDto.chatMessageId = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_ID);
chatMessageDto.message = messageInfoJSON.getString(MESSAGE); chatMessageDto.message = messageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
chatMessageDto.messageType = messageInfoJSON.getInt(MESSAGE_TYPE); chatMessageDto.messageType = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_TYPE);
if (messageInfoJSON.has(TIME)) { if (messageInfoJSON.has(ABookCommConstants.KEY.TIME)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(messageInfoJSON.getJSONObject(TIME).getLong(TIME)); chatMessageDto.insertDate = DateTimeUtil.millToDateString(messageInfoJSON.getJSONObject(ABookCommConstants.KEY.TIME).getLong(ABookCommConstants.KEY.TIME));
} }
chatMessageDtoArrayList.add(chatMessageDto); chatMessageDtoArrayList.add(chatMessageDto);
if (existShopMmeberMap.get(chatMessageDto.shopMemberId) != null) { continue; } if (existShopMmeberMap.get(chatMessageDto.shopMemberId) != null) { continue; }
ShopMemberDto shopMemberDto = new ShopMemberDto(); ShopMemberDto shopMemberDto = new ShopMemberDto();
shopMemberDto.shopMemberId = messageInfoJSON.getInt(SHOP_MEMBER_ID); shopMemberDto.shopMemberId = messageInfoJSON.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
shopMemberDto.shopMemberName = messageInfoJSON.getString(MEMBER_NAME); shopMemberDto.shopMemberName = messageInfoJSON.getString(ABookCommConstants.KEY.MEMBER_NAME);
if (messageInfoJSON.has(PROFILE_IMAGE_PATH)) { if (messageInfoJSON.has(ABookCommConstants.KEY.PROFILE_IMAGE_PATH)) {
shopMemberDto.profileUrl = messageInfoJSON.getString(PROFILE_IMAGE_PATH); shopMemberDto.profileUrl = messageInfoJSON.getString(ABookCommConstants.KEY.PROFILE_IMAGE_PATH);
} }
existShopMmeberMap.put(shopMemberDto.shopMemberId,shopMemberDto.shopMemberId); existShopMmeberMap.put(shopMemberDto.shopMemberId,shopMemberDto.shopMemberId);
shopMemberDtoArrayList.add(shopMemberDto); shopMemberDtoArrayList.add(shopMemberDto);
......
...@@ -5,6 +5,7 @@ import org.json.adf.JSONObject; ...@@ -5,6 +5,7 @@ import org.json.adf.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException; import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException; import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto; import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
...@@ -12,21 +13,7 @@ import jp.agentec.abook.abv.bl.dto.ChatRoomDto; ...@@ -12,21 +13,7 @@ import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
public class RoomListJSON extends AcmsCommonJSON { public class RoomListJSON extends AcmsCommonJSON {
private static final String Body = "body";
private static final String ChatRoomInfoList = "chatRoomInfoList";
private static final String InsertDate = "insertDate";
private static final String Time = "time";
private static final String RoomId = "roomId";
private static final String RoomName = "roomName";
private static final String RoomType = "roomType";
private static final String LastMessageInfo = "lastMessageInfo";
private static final String Message = "message";
private static final String MessageId = "messageId";
private static final String ShopMemberId = "shopMemberId";
private static final String MessageType = "messageType";
private static final String UnreadCount = "unreadCount";
private static final String AttendUsers = "attendUsers";
public ArrayList<ChatRoomDto> roomList; public ArrayList<ChatRoomDto> roomList;
...@@ -38,9 +25,9 @@ public class RoomListJSON extends AcmsCommonJSON { ...@@ -38,9 +25,9 @@ public class RoomListJSON extends AcmsCommonJSON {
protected void parse(JSONObject json) throws JSONValidationException { protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得 // ルーム一覧情報を取得
if (!json.has(Body)) { return; } if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONArray roomListJsonArray = json.getJSONObject(Body).getJSONArray(ChatRoomInfoList); JSONArray roomListJsonArray = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONArray(ABookCommConstants.KEY.CHAT_ROOM_INFO_LIST);
if (roomListJsonArray == null) { return; } if (roomListJsonArray == null) { return; }
roomList = new ArrayList<ChatRoomDto>(); roomList = new ArrayList<ChatRoomDto>();
...@@ -51,23 +38,23 @@ public class RoomListJSON extends AcmsCommonJSON { ...@@ -51,23 +38,23 @@ public class RoomListJSON extends AcmsCommonJSON {
ChatRoomDto chatRoomDto = new ChatRoomDto(); ChatRoomDto chatRoomDto = new ChatRoomDto();
ChatMessageDto chatMessageDto = new ChatMessageDto(); ChatMessageDto chatMessageDto = new ChatMessageDto();
chatRoomDto.chatRoomId = roomListJsonArray.getJSONObject(listCount).getInt(RoomId); chatRoomDto.chatRoomId = roomListJsonArray.getJSONObject(listCount).getInt(ABookCommConstants.KEY.ROOM_ID);
chatRoomDto.chatRoomName = roomListJsonArray.getJSONObject(listCount).getString(RoomName); chatRoomDto.chatRoomName = roomListJsonArray.getJSONObject(listCount).getString(ABookCommConstants.KEY.ROOM_NAME);
chatRoomDto.type = roomListJsonArray.getJSONObject(listCount).getInt(RoomType); chatRoomDto.type = roomListJsonArray.getJSONObject(listCount).getInt(ABookCommConstants.KEY.ROOM_TYPE);
chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).has(UnreadCount) ? roomListJsonArray.getJSONObject(listCount).getInt(UnreadCount) : 0; chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).has(ABookCommConstants.KEY.UNREAD_COUNT) ? roomListJsonArray.getJSONObject(listCount).getInt(ABookCommConstants.KEY.UNREAD_COUNT) : 0;
chatRoomDto.userCount = roomListJsonArray.getJSONObject(listCount).getJSONArray(AttendUsers).length(); chatRoomDto.userCount = roomListJsonArray.getJSONObject(listCount).getJSONArray(ABookCommConstants.KEY.ATTEND_USERS).length();
//最後メッセージ情報がある場合の処理 //最後メッセージ情報がある場合の処理
JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).has(LastMessageInfo) ? roomListJsonArray.getJSONObject(listCount).getJSONObject(LastMessageInfo) : null; JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).has(ABookCommConstants.KEY.LAST_MESSAGE_INFO) ? roomListJsonArray.getJSONObject(listCount).getJSONObject(ABookCommConstants.KEY.LAST_MESSAGE_INFO) : null;
if (lastMessageInfoJSON != null && lastMessageInfoJSON.has(MessageId)) { if (lastMessageInfoJSON != null && lastMessageInfoJSON.has(ABookCommConstants.KEY.MESSAGE_ID)) {
chatMessageDto.chatRoomId = chatRoomDto.chatRoomId; chatMessageDto.chatRoomId = chatRoomDto.chatRoomId;
chatMessageDto.message = lastMessageInfoJSON.getString(Message); chatMessageDto.message = lastMessageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
chatMessageDto.messageType = lastMessageInfoJSON.getInt(MessageType); chatMessageDto.messageType = lastMessageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_TYPE);
if (lastMessageInfoJSON.has(InsertDate)) { if (lastMessageInfoJSON.has(ABookCommConstants.KEY.INSERT_DATE)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(lastMessageInfoJSON.getJSONObject(InsertDate).getLong(Time)); chatMessageDto.insertDate = DateTimeUtil.millToDateString(lastMessageInfoJSON.getJSONObject(ABookCommConstants.KEY.INSERT_DATE).getLong(ABookCommConstants.KEY.TIME));
} }
chatMessageDto.shopMemberId = lastMessageInfoJSON.getInt(ShopMemberId); chatMessageDto.shopMemberId = lastMessageInfoJSON.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(MessageId); chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_ID);
chatRoomDto.lastMessageInfo = chatMessageDto; chatRoomDto.lastMessageInfo = chatMessageDto;
} }
roomList.add(chatRoomDto); roomList.add(chatRoomDto);
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
public class ShopMemberInfoJSON extends AcmsCommonJSON {
private static final String BODY = "body";
private static final String SHOP_MEMBER_ID = "shopMemberId";
private static final String MEMBER_NAME = "memberName";
private static final String PROFILE_IMAGE_PATH = "profileImagePath";
private static final String GROUP_ID_LIST = "groupIdList";
private static final Integer SELF_FLG_ON = 1;
public ShopMemberDto shopMemberDto;
public ShopMemberInfoJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
if (!json.has(BODY)) { return; }
JSONObject MyInfoJson = json.getJSONObject(BODY);
if (MyInfoJson == null) { return; }
shopMemberDto = new ShopMemberDto();
ArrayList<Integer> groupIdList = new ArrayList<Integer>();
JSONArray groupIdJsonArray = (JSONArray) MyInfoJson.get(GROUP_ID_LIST);
for (int i = 0; i < groupIdJsonArray.length(); i++) {
groupIdList.add(groupIdJsonArray.getInt(i));
}
shopMemberDto.groupIdList = groupIdList;
shopMemberDto.selfFlg = SELF_FLG_ON;
shopMemberDto.favoriteRegisterDate = null;
shopMemberDto.profileUrl = MyInfoJson.getString(PROFILE_IMAGE_PATH);
shopMemberDto.shopMemberId = MyInfoJson.getInt(SHOP_MEMBER_ID);
shopMemberDto.shopMemberName = MyInfoJson.getString(MEMBER_NAME);
}
}
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.adf.util.DateTimeUtil;
public class ShopMemberListJSON extends AcmsCommonJSON {
private static final String Body = "body";
private static final String ChatRoomInfoList = "chatRoomInfoList";
private static final String InsertDate = "insertDate";
private static final String Time = "time";
private static final String RoomId = "roomId";
private static final String RoomName = "roomName";
private static final String RoomType = "roomType";
private static final String LastMessageInfo = "lastMessageInfo";
private static final String Message = "message";
private static final String MessageId = "messageId";
private static final String ShopMemberId = "shopMemberId";
private static final String MessageType = "messageType";
private static final String UnreadCount = "unreadCount";
private static final String AttendUsers = "attendUsers";
public ArrayList<ChatRoomDto> roomList;
public ShopMemberListJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得
if (!json.has(Body)) { return; }
JSONArray roomListJsonArray = json.getJSONObject(Body).getJSONArray(ChatRoomInfoList);
if (roomListJsonArray == null) { return; }
roomList = new ArrayList<ChatRoomDto>();
for (int listCount = 0; listCount < roomListJsonArray.length(); listCount++) {
if (roomListJsonArray.getJSONObject(listCount).length() == 0) {
break;
}
ChatRoomDto chatRoomDto = new ChatRoomDto();
ChatMessageDto chatMessageDto = new ChatMessageDto();
chatRoomDto.chatRoomId = roomListJsonArray.getJSONObject(listCount).getInt(RoomId);
chatRoomDto.chatRoomName = roomListJsonArray.getJSONObject(listCount).getString(RoomName);
chatRoomDto.type = roomListJsonArray.getJSONObject(listCount).getInt(RoomType);
chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).has(UnreadCount) ? roomListJsonArray.getJSONObject(listCount).getInt(UnreadCount) : 0;
chatRoomDto.userCount = roomListJsonArray.getJSONObject(listCount).getJSONArray(AttendUsers).length();
//最後メッセージ情報がある場合の処理
JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).has(LastMessageInfo) ? roomListJsonArray.getJSONObject(listCount).getJSONObject(LastMessageInfo) : null;
if (lastMessageInfoJSON != null && lastMessageInfoJSON.has(MessageId)) {
chatMessageDto.chatRoomId = chatRoomDto.chatRoomId;
chatMessageDto.message = lastMessageInfoJSON.getString(Message);
chatMessageDto.messageType = lastMessageInfoJSON.getInt(MessageType);
if (lastMessageInfoJSON.has(InsertDate)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(lastMessageInfoJSON.getJSONObject(InsertDate).getLong(Time));
}
chatMessageDto.shopMemberId = lastMessageInfoJSON.getInt(ShopMemberId);
chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(MessageId);
chatRoomDto.lastMessageInfo = chatMessageDto;
}
roomList.add(chatRoomDto);
}
}
}
...@@ -37,8 +37,16 @@ public interface ABookCommConstants { ...@@ -37,8 +37,16 @@ public interface ABookCommConstants {
String MEMBER_NAME = "memberName"; String MEMBER_NAME = "memberName";
String DEL_FLG = "del_flg"; String DEL_FLG = "del_flg";
String ROOM_TYPE = "roomType"; String ROOM_TYPE = "roomType";
String GROUP_ID_LIST = "groupIdList"; String GROUP_ID_LIST = "groupIdList";
String MESSAGE_INFO_LIST = "messageInfoList";
String MESSAGE_ID = "messageId";
String SHOP_ID = "shopId";
String TIME = "time";
String GROUP_INFO_LIST = "groupInfoList";
String PARENT_GROUP_ID = "parentGroupId";
String GROUP_MEMBER_LIST = "groupMemberList";
String CHAT_ROOM_INFO_LIST = "chatRoomInfoList";
String LAST_MESSAGE_INFO = "lastMessageInfo";
} }
interface FLAG { interface FLAG {
......
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