Commit 1d61462f by Lee Munkyeong

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

parent 71204431
...@@ -542,10 +542,9 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -542,10 +542,9 @@ public class AcmsClient implements AcmsClientResponseListener {
* @throws AcmsException * @throws AcmsException
*/ */
public RoomListJSON getRoomList(String sid) throws NetworkDisconnectedException, AcmsException { public RoomListJSON getRoomList(String sid) throws NetworkDisconnectedException, AcmsException {
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;
} }
/** /**
...@@ -557,13 +556,22 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -557,13 +556,22 @@ public class AcmsClient implements AcmsClientResponseListener {
* @throws AcmsException * @throws AcmsException
*/ */
public MyInfoJSON getMyInfo(String sid) throws NetworkDisconnectedException, AcmsException { public MyInfoJSON getMyInfo(String sid) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetUser, new AcmsParameters(sid,AcmsApis.UserCmds.getMyInfo)); HttpResponse response = send(AcmsApis.ApigetUser, new AcmsParameters(sid, AcmsApis.UserCmds.getMyInfo));
MyInfoJSON json = new MyInfoJSON(response.httpResponseBody); MyInfoJSON json = new MyInfoJSON(response.httpResponseBody);
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);
return json; return json;
} }
...@@ -572,12 +580,14 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -572,12 +580,14 @@ public class AcmsClient implements AcmsClientResponseListener {
* 全てのグループ更新。 * 全てのグループ更新。
* *
* @param sid * @param sid
* @param groupId
* @param updatedDate
* @return * @return
* @throws NetworkDisconnectedException * @throws NetworkDisconnectedException
* @throws AcmsException * @throws AcmsException
*/ */
public GroupListJSON getGroupInfo(String sid,String groupId,String updatedDate) throws NetworkDisconnectedException, AcmsException { public GroupListJSON getGroupInfo(String sid,String groupId,String updatedDate) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetUser, new GetGroupInfoParameters(sid,AcmsApis.UserCmds.getGroupInfo,groupId,updatedDate)); HttpResponse response = send(AcmsApis.ApigetUser, new GetGroupInfoParameters(sid, AcmsApis.UserCmds.getGroupInfo,groupId, updatedDate));
GroupListJSON json = new GroupListJSON(response.httpResponseBody); GroupListJSON json = new GroupListJSON(response.httpResponseBody);
return json; return json;
} }
...@@ -586,12 +596,15 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -586,12 +596,15 @@ 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
*/ */
public CreatedRoomJSON createRoom(String sid, String roomType, String inviteMemberIds, String newRoomName) throws NetworkDisconnectedException, AcmsException { public CreatedRoomJSON createRoom(String sid, String roomType, String inviteMemberIds, String newRoomName) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetChatRooms, new CreateRoomParameters(sid,AcmsApis.RoomCmds.createRoom,roomType,inviteMemberIds,newRoomName)); HttpResponse response = send(AcmsApis.ApigetChatRooms, new CreateRoomParameters(sid, AcmsApis.RoomCmds.createRoom, roomType, inviteMemberIds, newRoomName));
CreatedRoomJSON json = new CreatedRoomJSON(response.httpResponseBody); CreatedRoomJSON json = new CreatedRoomJSON(response.httpResponseBody);
return json; return json;
} }
...@@ -600,12 +613,13 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -600,12 +613,13 @@ public class AcmsClient implements AcmsClientResponseListener {
* ルーム作成。 * ルーム作成。
* *
* @param sid * @param sid
* @param roomId
* @return * @return
* @throws NetworkDisconnectedException * @throws NetworkDisconnectedException
* @throws AcmsException * @throws AcmsException
*/ */
public MessageInfoListJSON getMessages(String sid, String roomId) throws NetworkDisconnectedException, AcmsException { public MessageInfoListJSON getMessages(String sid, String roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetMessage, new GetMessagesParameters(sid,AcmsApis.MessageCmds.getMessages,roomId,"0")); HttpResponse response = send(AcmsApis.ApigetMessage, new GetMessagesParameters(sid, AcmsApis.MessageCmds.getMessages, roomId,"0"));
MessageInfoListJSON json = new MessageInfoListJSON(response.httpResponseBody); MessageInfoListJSON json = new MessageInfoListJSON(response.httpResponseBody);
return json; return json;
} }
......
...@@ -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,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);
} }
} }
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";
}
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