Commit de8abff4 by Lee Munkyeong

Merge branch 'features/abcomm_sp3_contactUI' of…

Merge branch 'features/abcomm_sp3_contactUI' of https://gitlab.agentec.jp/abook_android/abook_check into features/abcomm_sp3_contactUI

# Conflicts:
#	ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/AcmsClient.java
parents c0a58918 ec9b0c65
...@@ -545,7 +545,6 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -545,7 +545,6 @@ public class AcmsClient implements AcmsClientResponseListener {
HttpResponse response = send(AcmsApis.ApigetChatRooms, new AcmsParameters(sid, AcmsApis.RoomCmds.getRoomList)); HttpResponse response = send(AcmsApis.ApigetChatRooms, new AcmsParameters(sid, AcmsApis.RoomCmds.getRoomList));
RoomListJSON json = new RoomListJSON(response.httpResponseBody); RoomListJSON json = new RoomListJSON(response.httpResponseBody);
return json; return json;
} }
/** /**
...@@ -562,6 +561,15 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -562,6 +561,15 @@ public class AcmsClient implements AcmsClientResponseListener {
return json; return json;
} }
/**
* サーバよりネームカード情報取得。
*
* @param sid
* @param shopMemberId
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public MyInfoJSON getNameCard(String sid, String shopMemberId) throws NetworkDisconnectedException, AcmsException { public MyInfoJSON getNameCard(String sid, String shopMemberId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetUser, new GetNameCardParameters(sid, AcmsApis.UserCmds.getNameCard, shopMemberId)); HttpResponse response = send(AcmsApis.ApigetUser, new GetNameCardParameters(sid, AcmsApis.UserCmds.getNameCard, shopMemberId));
MyInfoJSON json = new MyInfoJSON(response.httpResponseBody); MyInfoJSON json = new MyInfoJSON(response.httpResponseBody);
...@@ -572,6 +580,8 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -572,6 +580,8 @@ public class AcmsClient implements AcmsClientResponseListener {
* 全てのグループ更新。 * 全てのグループ更新。
* *
* @param sid * @param sid
* @param groupId
* @param updatedDate
* @return * @return
* @throws NetworkDisconnectedException * @throws NetworkDisconnectedException
* @throws AcmsException * @throws AcmsException
...@@ -586,6 +596,9 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -586,6 +596,9 @@ public class AcmsClient implements AcmsClientResponseListener {
* ルーム作成。 * ルーム作成。
* *
* @param sid * @param sid
* @param roomType
* @param inviteMemberIds
* @param newRoomName
* @return * @return
* @throws NetworkDisconnectedException * @throws NetworkDisconnectedException
* @throws AcmsException * @throws AcmsException
...@@ -600,6 +613,7 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -600,6 +613,7 @@ public class AcmsClient implements AcmsClientResponseListener {
* ルーム作成。 * ルーム作成。
* *
* @param sid * @param sid
* @param roomId
* @return * @return
* @throws NetworkDisconnectedException * @throws NetworkDisconnectedException
* @throws AcmsException * @throws AcmsException
......
...@@ -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.ChatRoomDto; import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
...@@ -12,17 +13,6 @@ import jp.agentec.abook.abv.bl.dto.GroupDto; ...@@ -12,17 +13,6 @@ import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto; import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
public class CreatedRoomJSON extends AcmsCommonJSON { public class CreatedRoomJSON extends AcmsCommonJSON {
private static final String Body = "body";
private static final String CHAT_ROOM_INFO = "chatRoomInfo";
private static final String ROOM_ID = "roomId";
private static final String ROOM_NAME = "roomName";
private static final String ATTEND_USERS = "attendUsers";
private static final String MEMBER_NAME = "memberName";
private static final String SHOP_MEMBER_ID = "shopMemberId";
private static final String PROFILE_IMAGE_PATH = "profileImagePath";
private static final String DEL_FLG = "del_flg";
private static final String ROOM_TYPE = "roomType";
public ArrayList<ShopMemberDto> attendUsers; public ArrayList<ShopMemberDto> attendUsers;
public ChatRoomDto chatRoomDto; public ChatRoomDto chatRoomDto;
...@@ -35,20 +25,18 @@ public class CreatedRoomJSON extends AcmsCommonJSON { ...@@ -35,20 +25,18 @@ public class CreatedRoomJSON 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; }
JSONObject createdRoomJson = json.getJSONObject(Body).getJSONObject(CHAT_ROOM_INFO); JSONObject createdRoomJson = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONObject(ABookCommConstants.KEY.CHAT_ROOM_INFO);
if (createdRoomJson == null) { return; } if (createdRoomJson == null) { return; }
JSONArray groupListJsonArray = createdRoomJson.getJSONArray(ATTEND_USERS); JSONArray groupListJsonArray = createdRoomJson.getJSONArray(ABookCommConstants.KEY.ATTEND_USERS);
chatRoomDto = new ChatRoomDto(); chatRoomDto = new ChatRoomDto();
chatRoomDto.userCount = groupListJsonArray.length(); chatRoomDto.userCount = groupListJsonArray.length();
chatRoomDto.chatRoomId = createdRoomJson.getInt(ROOM_ID); chatRoomDto.chatRoomId = createdRoomJson.getInt(ABookCommConstants.KEY.ROOM_ID);
chatRoomDto.chatRoomName = createdRoomJson.getString(ROOM_NAME); chatRoomDto.chatRoomName = createdRoomJson.getString(ABookCommConstants.KEY.ROOM_NAME);
chatRoomDto.type = createdRoomJson.getInt(ROOM_TYPE); chatRoomDto.type = createdRoomJson.getInt(ABookCommConstants.KEY.ROOM_TYPE);
chatRoomDto.unreadCount = 0;
} }
} }
......
...@@ -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,21 +5,12 @@ import org.json.adf.JSONObject; ...@@ -5,21 +5,12 @@ 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.ShopMemberDto; import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
public class MyInfoJSON extends AcmsCommonJSON { public class MyInfoJSON 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 ShopMemberDto shopMemberDto;
...@@ -30,24 +21,22 @@ public class MyInfoJSON extends AcmsCommonJSON { ...@@ -30,24 +21,22 @@ public class MyInfoJSON extends AcmsCommonJSON {
@Override @Override
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; }
JSONObject MyInfoJson = json.getJSONObject(BODY); JSONObject MyInfoJson = json.getJSONObject(ABookCommConstants.KEY.BODY);
if (MyInfoJson == null) { return; } if (MyInfoJson == null) { return; }
shopMemberDto = new ShopMemberDto(); shopMemberDto = new ShopMemberDto();
ArrayList<Integer> groupIdList = new ArrayList<Integer>(); ArrayList<Integer> groupIdList = new ArrayList<Integer>();
JSONArray groupIdJsonArray = (JSONArray) MyInfoJson.get(GROUP_ID_LIST); JSONArray groupIdJsonArray = (JSONArray) MyInfoJson.get(ABookCommConstants.KEY.GROUP_ID_LIST);
for (int i = 0; i < groupIdJsonArray.length(); i++) { for (int i = 0; i < groupIdJsonArray.length(); i++) {
groupIdList.add(groupIdJsonArray.getInt(i)); groupIdList.add(groupIdJsonArray.getInt(i));
} }
shopMemberDto.groupIdList = groupIdList; shopMemberDto.groupIdList = groupIdList;
shopMemberDto.selfFlg = SELF_FLG_ON; shopMemberDto.selfFlg = ABookCommConstants.FLAG.SELF_FLAG.ON;
shopMemberDto.favoriteRegisterDate = null; shopMemberDto.profileUrl = MyInfoJson.getString(ABookCommConstants.KEY.PROFILE_IMAGE_PATH);
shopMemberDto.profileUrl = MyInfoJson.getString(PROFILE_IMAGE_PATH); shopMemberDto.shopMemberId = MyInfoJson.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
shopMemberDto.shopMemberId = MyInfoJson.getInt(SHOP_MEMBER_ID); shopMemberDto.shopMemberName = MyInfoJson.getString(ABookCommConstants.KEY.MEMBER_NAME);
shopMemberDto.shopMemberName = MyInfoJson.getString(MEMBER_NAME);
} }
} }
...@@ -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);
}
}
}
package jp.agentec.abook.abv.bl.common.constant;
/**
* Created by leemk on 2021/03/03.
*/
public interface ABookCommConstants {
//AbookComm専用の共通インターフェース
interface KEY {
String CHAT_ROOM_ID = "chatRoomId";
String CHAT_ROOM_NAME = "chatRoomName";
String TYPE = "type";
String FAVORITE_REGISTER_DATE = "favoriteRegisterDate";
String UNREAD_COUNT = "unreadCount";
String MESSAGE = "message";
String MESSAGE_TYPE = "messageType";
String INSERT_DATE = "insertDate";
String USER_COUNT = "userCount";
String LOGIN_ID = "loginId";
String PROFILE_IMAGE_PATH = "profileImagePath";
String SELF_FLG = "selfFlg";
String SHOP_MEMBER_NAME = "shopMemberName";
String SHOP_MEMBER_ID = "shopMemberId";
String PROFILE_URL = "profileUrl";
String GROUP_NAME = "groupName";
String GROUP_ID = "groupId";
String GROUP_PATH_LIST = "groupPathList";
String CHILD_GROUP_LIST = "childGroupList";
String GROUP_USER_LIST = "groupUserList";
String BODY = "body";
String CHAT_ROOM_INFO = "chatRoomInfo";
String ROOM_ID = "roomId";
String ROOM_NAME = "roomName";
String ATTEND_USERS = "attendUsers";
String MEMBER_NAME = "memberName";
String DEL_FLG = "del_flg";
String ROOM_TYPE = "roomType";
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 SELF_FLAG {
Integer OFF = 0;
Integer ON = 1;
}
}
}
...@@ -506,7 +506,23 @@ public class GroupDao extends AbstractDao { ...@@ -506,7 +506,23 @@ public class GroupDao extends AbstractDao {
list = rawQueryGetDtoList("select * from m_group mg where (mg.group_id = ?) UNION select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ baseId, ""+ parentId}, GroupDto.class); list = rawQueryGetDtoList("select * from m_group mg where (mg.group_id = ?) UNION select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ baseId, ""+ parentId}, GroupDto.class);
return list; return list;
} }
public List<GroupDto> getGroupTree(Integer groupId) {
List<GroupDto> list;
StringBuffer sql = new StringBuffer();
sql.append(" WITH group_loop AS ");
sql.append(" ( ");
sql.append(" SELECT 1 rownum,group_id,group_name,parent_group_id,user_group_flg from m_group where group_id = ? ");
sql.append(" UNION ALL ");
sql.append(" SELECT rownum+1 rownum,parent.group_id,parent. group_name,parent.parent_group_id,parent.user_group_flg ");
sql.append(" FROM group_loop inner join m_group parent on parent.group_id = group_loop.parent_group_id ");
sql.append(" ) ");
sql.append(" SELECT * FROM group_loop ORDER BY group_loop.rownum DESC ");
list = rawQueryGetDtoList(sql.toString(), new String[]{""+ groupId}, GroupDto.class);
return list;
}
public List<GroupDto> getGroupChildList(int parentId) { public List<GroupDto> getGroupChildList(int parentId) {
List<GroupDto> list; List<GroupDto> list;
list = rawQueryGetDtoList("select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ parentId}, GroupDto.class); list = rawQueryGetDtoList("select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ parentId}, GroupDto.class);
...@@ -536,12 +552,12 @@ public class GroupDao extends AbstractDao { ...@@ -536,12 +552,12 @@ public class GroupDao extends AbstractDao {
public void insertGroupList(List<GroupDto> groupList) { public void insertGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" INSERT OR IGNORE INTO m_group (group_id, parent_group_id, group_name, group_path, group_level, user_group_flg) "); sql.append(" INSERT INTO m_group (group_id, parent_group_id, group_name, group_path, group_level, user_group_flg) ");
sql.append(" VALUES (?,?,?,?,?,?) "); sql.append(" VALUES (?,?,?,?,?,?) ");
try { try {
beginTransaction(); beginTransaction();
for (GroupDto groupDto : groupList) { for (GroupDto groupDto : groupList) {
insert(sql.toString(), new Object[] { groupDto.groupId, groupDto.parentGroupId, groupDto.groupName, "", 0, 0 }); insert(sql.toString(), new Object[] { groupDto.groupId, groupDto.parentGroupId, groupDto.groupName, ""+ groupDto.groupId, 0, 0 });
} }
commit(); commit();
} catch (Exception e) { } catch (Exception e) {
......
...@@ -113,6 +113,7 @@ public class ShopMemberDao extends AbstractDao { ...@@ -113,6 +113,7 @@ public class ShopMemberDao extends AbstractDao {
sql.append(" INNER JOIN r_shop_member_group AS rsmg "); sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id "); sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE rsmg.group_id =?"); sql.append(" WHERE rsmg.group_id =?");
sql.append(" AND sm.self_flg != 1");
sql.append(" ORDER BY sm.shop_member_name DESC "); sql.append(" ORDER BY sm.shop_member_name DESC ");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), new String[]{""+ groupId}, ShopMemberDto.class); List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), new String[]{""+ groupId}, ShopMemberDto.class);
return list; return list;
...@@ -128,7 +129,7 @@ public class ShopMemberDao extends AbstractDao { ...@@ -128,7 +129,7 @@ public class ShopMemberDao extends AbstractDao {
sql.append(" m_shop_member AS sm "); sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg "); sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id "); sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE rsmg.group_id IN (SELECT group_id FROM m_shop_member INNER JOIN r_shop_member_group WHERE self_flg = 1 GROUP BY group_id)"); sql.append(" WHERE rsmg.group_id IN (SELECT group_id FROM m_shop_member INNER JOIN r_shop_member_group ON m_shop_member.shop_member_id = r_shop_member_group.shop_member_id WHERE self_flg = 1 GROUP BY group_id)");
sql.append(" AND sm.self_flg != 1 "); sql.append(" AND sm.self_flg != 1 ");
sql.append(" ORDER BY sm.shop_member_name DESC "); sql.append(" ORDER BY sm.shop_member_name DESC ");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), null, ShopMemberDto.class); List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), null, ShopMemberDto.class);
......
...@@ -9,7 +9,7 @@ public class ChatRoomDto extends AbstractDto { ...@@ -9,7 +9,7 @@ public class ChatRoomDto extends AbstractDto {
public String chatRoomName; public String chatRoomName;
public Integer type; public Integer type;
public String favoriteRegisterDate = ""; public String favoriteRegisterDate = "";
public Integer unreadCount; public Integer unreadCount = 0;
public Integer userCount; public Integer userCount;
public String message; public String message;
public Integer messageType; public Integer messageType;
......
...@@ -20,6 +20,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.DownloadedContentInfoJSON; ...@@ -20,6 +20,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.DownloadedContentInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON; import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentCheckParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentCheckParameters;
import jp.agentec.abook.abv.bl.common.ABVEnvironment; import jp.agentec.abook.abv.bl.common.ABVEnvironment;
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.NetworkDisconnectedException; import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
...@@ -75,15 +76,15 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -75,15 +76,15 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (ChatRoomDto chatRoomDto : chatRoomList) { for (ChatRoomDto chatRoomDto : chatRoomList) {
Map<String, Object> chatRoomMap = new HashMap<String, Object>(); Map<String, Object> chatRoomMap = new HashMap<String, Object>();
chatRoomMap.put("chatRoomId", chatRoomDto.chatRoomId); chatRoomMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatRoomDto.chatRoomId);
chatRoomMap.put("chatRoomName", chatRoomDto.chatRoomName); chatRoomMap.put(ABookCommConstants.KEY.CHAT_ROOM_NAME, chatRoomDto.chatRoomName);
chatRoomMap.put("type", chatRoomDto.type); chatRoomMap.put(ABookCommConstants.KEY.TYPE, chatRoomDto.type);
chatRoomMap.put("favoriteRegisterDate", chatRoomDto.favoriteRegisterDate); chatRoomMap.put(ABookCommConstants.KEY.FAVORITE_REGISTER_DATE, chatRoomDto.favoriteRegisterDate);
chatRoomMap.put("unreadCount", chatRoomDto.unreadCount); chatRoomMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatRoomDto.unreadCount);
chatRoomMap.put("message", chatRoomDto.message); chatRoomMap.put(ABookCommConstants.KEY.MESSAGE, chatRoomDto.message);
chatRoomMap.put("messageType", chatRoomDto.messageType); chatRoomMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatRoomDto.messageType);
chatRoomMap.put("insertDate", chatRoomDto.insertDate); chatRoomMap.put(ABookCommConstants.KEY.INSERT_DATE, chatRoomDto.insertDate);
chatRoomMap.put("userCount", chatRoomDto.userCount); chatRoomMap.put(ABookCommConstants.KEY.USER_COUNT, chatRoomDto.userCount);
JSONObject jsonObject = new JSONObject(chatRoomMap); JSONObject jsonObject = new JSONObject(chatRoomMap);
resultJsonArray.put(jsonObject); resultJsonArray.put(jsonObject);
} }
...@@ -98,13 +99,13 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -98,13 +99,13 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (ChatMessageDto chatMessageDto : chatMessageDtoList) { for (ChatMessageDto chatMessageDto : chatMessageDtoList) {
Map<String, Object> chatMessageMap = new HashMap<String, Object>(); Map<String, Object> chatMessageMap = new HashMap<String, Object>();
chatMessageMap.put("chatRoomId", chatMessageDto.chatRoomId); chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId);
chatMessageMap.put("loginId", chatMessageDto.shopMemberName); chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName);
chatMessageMap.put("message", chatMessageDto.message); chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, chatMessageDto.message);
chatMessageMap.put("messageType", chatMessageDto.messageType); chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatMessageDto.messageType);
chatMessageMap.put("insertDate", chatMessageDto.insertDate); chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate);
chatMessageMap.put("profileImagePath", chatMessageDto.profileUrl); chatMessageMap.put(ABookCommConstants.KEY.PROFILE_IMAGE_PATH, chatMessageDto.profileUrl);
chatMessageMap.put("selfFlg", chatMessageDto.selfFlg); chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg);
JSONObject jsonObject = new JSONObject(chatMessageMap); JSONObject jsonObject = new JSONObject(chatMessageMap);
resultJsonArray.put(jsonObject); resultJsonArray.put(jsonObject);
} }
...@@ -117,10 +118,10 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -117,10 +118,10 @@ public class CommunicationLogic extends AbstractLogic {
ShopMemberDto myInfo = shopMemberDao.getMyInfo(); ShopMemberDto myInfo = shopMemberDao.getMyInfo();
List<String> groupPathList = groupDao.getMyGroupPathList(); List<String> groupPathList = groupDao.getMyGroupPathList();
JSONObject myInfoJson = new JSONObject(); JSONObject myInfoJson = new JSONObject();
myInfoJson.put("shopMemberId", myInfo.shopMemberId); myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, myInfo.shopMemberId);
myInfoJson.put("shopMemberName", myInfo.shopMemberName); myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, myInfo.shopMemberName);
myInfoJson.put("profileUrl", myInfo.profileUrl); myInfoJson.put(ABookCommConstants.KEY.PROFILE_URL, myInfo.profileUrl);
myInfoJson.put("groupPathList", groupPathList); myInfoJson.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathList);
String myInfoStr = myInfoJson.toString(); String myInfoStr = myInfoJson.toString();
return myInfoStr; return myInfoStr;
} }
...@@ -130,9 +131,9 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -130,9 +131,9 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray myGroupUsersJson = new JSONArray(); JSONArray myGroupUsersJson = new JSONArray();
for (ShopMemberDto myGroupUser : myGroupUsers) { for (ShopMemberDto myGroupUser : myGroupUsers) {
Map<String, Object> myGroupUserMap = new HashMap<String, Object>(); Map<String, Object> myGroupUserMap = new HashMap<String, Object>();
myGroupUserMap.put("shopMemberId", myGroupUser.shopMemberId); myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, myGroupUser.shopMemberId);
myGroupUserMap.put("shopMemberName", myGroupUser.shopMemberName); myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, myGroupUser.shopMemberName);
myGroupUserMap.put("profileUrl", myGroupUser.profileUrl); myGroupUserMap.put(ABookCommConstants.KEY.PROFILE_URL, myGroupUser.profileUrl);
JSONObject jsonObject = new JSONObject(myGroupUserMap); JSONObject jsonObject = new JSONObject(myGroupUserMap);
myGroupUsersJson.put(jsonObject); myGroupUsersJson.put(jsonObject);
} }
...@@ -159,9 +160,9 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -159,9 +160,9 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto favoriteUser : favoriteUsers) { for (ShopMemberDto favoriteUser : favoriteUsers) {
Map<String, Object> favoriteUserMap = new HashMap<String, Object>(); Map<String, Object> favoriteUserMap = new HashMap<String, Object>();
favoriteUserMap.put("shopMemberId", favoriteUser.shopMemberId); favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, favoriteUser.shopMemberId);
favoriteUserMap.put("shopMemberName", favoriteUser.shopMemberName); favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, favoriteUser.shopMemberName);
favoriteUserMap.put("profileUrl", favoriteUser.profileUrl); favoriteUserMap.put(ABookCommConstants.KEY.PROFILE_URL, favoriteUser.profileUrl);
JSONObject jsonObject = new JSONObject(favoriteUserMap); JSONObject jsonObject = new JSONObject(favoriteUserMap);
resultJsonArray.put(jsonObject); resultJsonArray.put(jsonObject);
} }
...@@ -177,8 +178,8 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -177,8 +178,8 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (GroupDto favoriteGroup : favoriteGroups) { for (GroupDto favoriteGroup : favoriteGroups) {
Map<String, Object> favoriteGroupMap = new HashMap<String, Object>(); Map<String, Object> favoriteGroupMap = new HashMap<String, Object>();
favoriteGroupMap.put("groupName", favoriteGroup.groupName); favoriteGroupMap.put(ABookCommConstants.KEY.GROUP_NAME, favoriteGroup.groupName);
favoriteGroupMap.put("groupId", favoriteGroup.groupId); favoriteGroupMap.put(ABookCommConstants.KEY.GROUP_ID, favoriteGroup.groupId);
JSONObject jsonObject = new JSONObject(favoriteGroupMap); JSONObject jsonObject = new JSONObject(favoriteGroupMap);
resultJsonArray.put(jsonObject); resultJsonArray.put(jsonObject);
} }
...@@ -187,6 +188,59 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -187,6 +188,59 @@ public class CommunicationLogic extends AbstractLogic {
return favoriteGroupsStr; return favoriteGroupsStr;
} }
public String getGroupSearchData(Integer groupId) {
//レスポンスになるJSON
JSONObject groupSearchData = new JSONObject();
//パラメータグループIDが0であれば自分のグループ情報を取得。
GroupDto myGroup = groupDao.getUserGroups().get(0);
Integer targetGroupId;
if (groupId == 0) {
targetGroupId = myGroup.groupId;
} else {
targetGroupId = groupId;
}
//グループ
List<GroupDto> groupPathList = groupDao.getGroupTree(targetGroupId);
JSONArray groupPathJSONArray = new JSONArray();
for (GroupDto group : groupPathList) {
Map<String, Object> groupTreeMap = new HashMap<String, Object>();
groupTreeMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName);
groupTreeMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId);
JSONObject jsonObject = new JSONObject(groupTreeMap);
groupPathJSONArray.put(jsonObject);
}
groupSearchData.put(ABookCommConstants.KEY.GROUP_PATH_LIST,groupPathJSONArray);
List<GroupDto> childGroupList = groupDao.getGroupChildList(targetGroupId);
JSONArray childGroupJSONArray = new JSONArray();
for (GroupDto group : childGroupList) {
Map<String, Object> groupTreeMap = new HashMap<String, Object>();
groupTreeMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName);
groupTreeMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId);
JSONObject jsonObject = new JSONObject(groupTreeMap);
childGroupJSONArray.put(jsonObject);
}
groupSearchData.put(ABookCommConstants.KEY.CHILD_GROUP_LIST,childGroupJSONArray);
List<ShopMemberDto> shopMemberList = shopMemberDao.getUserListByGroupId(targetGroupId);
JSONArray shopMemberJSONArray = new JSONArray();
for (ShopMemberDto shopMember : shopMemberList) {
Map<String, Object> shopMemberMap = new HashMap<String, Object>();
shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId);
shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
shopMemberMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl);
JSONObject jsonObject = new JSONObject(shopMemberMap);
shopMemberJSONArray.put(jsonObject);
}
groupSearchData.put(ABookCommConstants.KEY.GROUP_USER_LIST,shopMemberJSONArray);
String groupSearchDataStr = groupSearchData.toString();
return groupSearchDataStr;
}
public void insertChatRoomList(List<ChatRoomDto> roomList) { public void insertChatRoomList(List<ChatRoomDto> roomList) {
List<ChatMessageDto> insertMessageList = new ArrayList<ChatMessageDto>(); List<ChatMessageDto> insertMessageList = new ArrayList<ChatMessageDto>();
......
...@@ -706,8 +706,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -706,8 +706,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
@JavascriptInterface @JavascriptInterface
public void updateGroupInfo() throws NetworkDisconnectedException, AcmsException { public void updateGroupInfo(String groupId) throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer("0"); updateGroupInfoFromServer(groupId);
} }
@JavascriptInterface @JavascriptInterface
...@@ -775,6 +775,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -775,6 +775,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
updateUserInfoFromServer(shopMemberId); updateUserInfoFromServer(shopMemberId);
} }
@JavascriptInterface
public String getGroupInfo(String groupId) throws NetworkDisconnectedException, AcmsException {
String groupInfoStr = communicationLogic.getGroupSearchData(Integer.parseInt(groupId));
return groupInfoStr;
}
} }
/** /**
......
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