Commit 2fee6674 by Lee Munkyeong

Merge branch 'communication/feature/performance_improvement' into 'communication/develop'

Communication/feature/performance improvement

See merge request !178
parents 781c5243 40c8c327
......@@ -40,10 +40,12 @@ import jp.agentec.abook.abv.bl.acms.client.json.OperationListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ProcessDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RequirePasswordChangeJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServiceOptionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UnreadCountJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UserInviteResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AbstractAcmsLoginParameters;
......@@ -564,6 +566,12 @@ public class AcmsClient implements AcmsClientResponseListener {
return json;
}
public RoomJSON getRoom(String sid,String roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetChatRooms, new GetMessagesParameters(sid, AcmsApis.RoomCmds.getRoom, roomId, null, null, null ));
RoomJSON json = new RoomJSON(response.httpResponseBody);
return json;
}
/**
* ログインしたユーザの情報を取得する。
*
......@@ -597,14 +605,13 @@ public class AcmsClient implements AcmsClientResponseListener {
* 全てのグループ更新。
*
* @param sid
* @param groupId
* @param updatedDate
* @return
* @throws NetworkDisconnectedException
* @throws 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));
public GroupListJSON getGroupInfo(String sid, String updatedDate) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetUser, new GetGroupInfoParameters(sid, AcmsApis.UserCmds.getGroupInfo, updatedDate));
GroupListJSON json = new GroupListJSON(response.httpResponseBody);
return json;
}
......@@ -651,12 +658,17 @@ public class AcmsClient implements AcmsClientResponseListener {
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public MessageInfoListJSON getMessages(String sid, String roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetMessage, new GetMessagesParameters(sid, AcmsApis.MessageCmds.getMessages, roomId, "0"));
public MessageInfoListJSON getMessages(String sid, String roomId, String messageId, String updateDate) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetMessage, new GetMessagesParameters(sid, AcmsApis.MessageCmds.getMessages, roomId, "0", messageId, updateDate));
MessageInfoListJSON json = new MessageInfoListJSON(response.httpResponseBody);
return json;
}
public UnreadCountJSON getMessagesUnreadCount(String sid, String roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetMessage, new GetMessagesParameters(sid, AcmsApis.MessageCmds.getUnreadCount, roomId, "0", null, null));
UnreadCountJSON json = new UnreadCountJSON(response.httpResponseBody);
return json;
}
/**
* ユーザ招待。
*
......@@ -1128,9 +1140,7 @@ public class AcmsClient implements AcmsClientResponseListener {
*/
private HttpResponse send(String methodName, HttpParameterObject param) throws NetworkDisconnectedException, AcmsException {
Logger.d(TAG, "call api : %s", methodName);
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, methodName);
HttpResponse response = send(apiUrl, methodName, param);
// 最終アクセス時間更新
......
......@@ -8,9 +8,11 @@ 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.JSONValidationException;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.dto.ArchiveDto;
import jp.agentec.abook.abv.bl.dto.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class ArchiveListJSON extends AcmsCommonJSON {
......@@ -41,18 +43,25 @@ public class ArchiveListJSON extends AcmsCommonJSON {
ArchiveDto archiveDto = new ArchiveDto();
archiveDto.archiveId = archiveJSON.getInt(ABookCommConstants.KEY.ARCHIVE_ID);
archiveDto.collaborationDetailId = archiveJSON.getInt(ABookCommConstants.KEY.COLLABORATION_DEATAIL_ID);
archiveDto.archiveName = archiveJSON.getString(ABookCommConstants.KEY.ARCHIVE_NAME);
archiveDto.archiveType = archiveJSON.getInt(ABookCommConstants.KEY.ARCHIVE_TYPE);
archiveDto.archiveDate = DateTimeUtil.millToDateString(archiveJSON.getJSONObject(ABookCommConstants.KEY.ARCHIVE_DATE)
.getLong(ABookCommConstants.KEY.TIME), "yyyy/MM/dd HH:mm");
archiveDto.archiveType = archiveJSON.getInt(ABookCommConstants.KEY.ARCHIVE_TYPE);
archiveDto.delFlg = archiveJSON.getInt(ABookCommConstants.KEY.DEL_FLG);
archiveDto.collaborationDetailId = archiveJSON.getInt(ABookCommConstants.KEY.COLLABORATION_DEATAIL_ID);
archiveDto.roomId = archiveJSON.getInt(ABookCommConstants.KEY.ROOM_ID);
archiveDto.saveUserId = archiveJSON.getInt(ABookCommConstants.KEY.SAVE_USER_ID);
archiveDto.filePath = archiveJSON.getString(ABookCommConstants.KEY.FILE_PATH);
if (archiveJSON.has(ABookCommConstants.KEY.ATTEND_USER_IDS)) {
archiveDto.attendUserIds = archiveJSON.getJSONArray(ABookCommConstants.KEY.ATTEND_USER_IDS).toString();
}
archiveList.add(archiveDto);
}
if (json.getJSONObject(ABookCommConstants.KEY.BODY).has(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE)) {
archiveLastUpdateDate = json.getJSONObject(ABookCommConstants.KEY.BODY).getString(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE);
}
String time = JsonUtil.getString(json, PresentTime);
presentTime = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
archiveLastUpdateDate = DateTimeUtil.toString(presentTime, DateTimeFormat.yyyyMMddHHmmss_none);
}
}
......@@ -4,18 +4,22 @@ import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import java.util.Date;
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.JSONValidationException;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.dto.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class GroupListJSON extends AcmsCommonJSON {
public ArrayList<ChatGroupDto> groupList;
public String allGroupLastUpdateDate;
public String lastRequestDate;
public GroupListJSON(String jsonString) throws AcmsException {
super(jsonString);
......@@ -46,9 +50,6 @@ public class GroupListJSON extends AcmsCommonJSON {
}
groupDto.groupName = groupJSON.getString(ABookCommConstants.KEY.GROUP_NAME);
groupDto.delFlg = groupJSON.getInt(ABookCommConstants.KEY.DEL_FLG);
if (groupJSON.has(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE)) {
groupDto.updateDate = groupJSON.getString(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE);
}
if (groupJSON.has(ABookCommConstants.KEY.GROUP_MEMBER_LIST)) {
JSONArray groupMemberJsonArray = groupJSON.getJSONArray(ABookCommConstants.KEY.GROUP_MEMBER_LIST);
ArrayList<ShopMemberDto> groupMembers = new ArrayList<ShopMemberDto>();
......@@ -62,19 +63,15 @@ public class GroupListJSON extends AcmsCommonJSON {
if (groupMember.has(ABookCommConstants.KEY.PROFILE_IMAGE_PATH)) {
shopMemberDto.profileUrl = groupMember.getString(ABookCommConstants.KEY.PROFILE_IMAGE_PATH);
}
ArrayList groupIds = new ArrayList();
groupIds.add(groupDto.groupId);
shopMemberDto.groupIdList = groupIds;
groupMembers.add(shopMemberDto);
}
groupDto.groupMembers = groupMembers;
}
groupList.add(groupDto);
}
if (json.getJSONObject(ABookCommConstants.KEY.BODY).has(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE)) {
allGroupLastUpdateDate = json.getJSONObject(ABookCommConstants.KEY.BODY).getString(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE);
}
String time = JsonUtil.getString(json, PresentTime);
presentTime = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
lastRequestDate = DateTimeUtil.toString(presentTime, DateTimeFormat.yyyyMMddHHmmss_none);
}
}
......
......@@ -9,8 +9,10 @@ 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.JSONValidationException;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class MessageInfoListJSON extends AcmsCommonJSON {
......@@ -18,6 +20,7 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
public ArrayList<ChatMessageDto> chatMessageDtoArrayList;
public ArrayList<ShopMemberDto> shopMemberDtoArrayList;
public String updateDate;
public MessageInfoListJSON(String jsonString) throws AcmsException {
super(jsonString);
......@@ -54,14 +57,11 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
} else {
chatMessageDto.message = messageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
}
chatMessageDto.unreadCount = messageInfoJSON.getInt(ABookCommConstants.KEY.UNREAD_COUNT);
if (messageInfoJSON.has(ABookCommConstants.KEY.TIME)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(messageInfoJSON.getJSONObject(ABookCommConstants.KEY.TIME).getLong(ABookCommConstants.KEY.TIME));
}
chatMessageDtoArrayList.add(chatMessageDto);
if (existShopMmeberMap.get(chatMessageDto.shopMemberId) != null) { continue; }
ShopMemberDto shopMemberDto = new ShopMemberDto();
shopMemberDto.shopMemberId = messageInfoJSON.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
......@@ -74,6 +74,10 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
shopMemberDtoArrayList.add(shopMemberDto);
}
String time = JsonUtil.getString(json, PresentTime);
presentTime = DateTimeUtil.toDate(time, DateTimeFormat.yyyyMMddHHmmss_hyphen);
updateDate = DateTimeUtil.toString(presentTime, DateTimeFormat.yyyyMMddHHmmss_none);
}
}
......@@ -27,12 +27,12 @@ public class MyInfoJSON extends AcmsCommonJSON {
if (MyInfoJson == null) { return; }
shopMemberDto = new ShopMemberDto();
ArrayList<Integer> groupIdList = new ArrayList<Integer>();
JSONArray groupIdJsonArray = (JSONArray) MyInfoJson.get(ABookCommConstants.KEY.GROUP_ID_LIST);
//ArrayList<Integer> groupIdList = new ArrayList<Integer>();
/*JSONArray groupIdJsonArray = (JSONArray) MyInfoJson.get(ABookCommConstants.KEY.GROUP_ID_LIST);
for (int i = 0; i < groupIdJsonArray.length(); i++) {
groupIdList.add(groupIdJsonArray.getInt(i));
}
shopMemberDto.groupIdList = groupIdList;
}*/
//shopMemberDto.groupIdList = groupIdList;
shopMemberDto.selfFlg = ABookCommConstants.FLAG.SELF_FLAG.ON;
shopMemberDto.profileUrl = MyInfoJson.getString(ABookCommConstants.KEY.PROFILE_IMAGE_PATH);
shopMemberDto.shopMemberId = MyInfoJson.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
......
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.constant.ABookCommConstants;
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 RoomJSON extends AcmsCommonJSON {
public ChatRoomDto chatRoomDto;
public RoomJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONObject roomInfo = json.getJSONObject(ABookCommConstants.KEY.BODY);
chatRoomDto = new ChatRoomDto();
chatRoomDto.chatRoomId = roomInfo.getInt(ABookCommConstants.KEY.ROOM_ID);
chatRoomDto.chatRoomName = roomInfo.getString(ABookCommConstants.KEY.ROOM_NAME);
chatRoomDto.type = roomInfo.getInt(ABookCommConstants.KEY.ROOM_TYPE);
chatRoomDto.userCount = roomInfo.getJSONArray(ABookCommConstants.KEY.ATTEND_USER_IDS).length();
JSONArray attendUsers = roomInfo.getJSONArray(ABookCommConstants.KEY.ATTEND_USER_IDS);
ArrayList<Integer> attendUserList = new ArrayList<Integer>();
for (int attendUserCount = 0; attendUserCount < attendUsers.length(); attendUserCount++) {
attendUserList.add((Integer) attendUsers.get(attendUserCount));
}
chatRoomDto.attendUsers = attendUserList;
}
}
......@@ -48,8 +48,13 @@ public class RoomListJSON extends AcmsCommonJSON {
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(ABookCommConstants.KEY.MESSAGE_ID)) {
chatMessageDto.chatRoomId = chatRoomDto.chatRoomId;
chatMessageDto.message = lastMessageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
chatMessageDto.messageType = lastMessageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_TYPE);
if (ABookCommConstants.FLAG.MESSAGE_TYPE.COLLABORATION_START.equals(chatMessageDto.messageType)
|| ABookCommConstants.FLAG.MESSAGE_TYPE.COLLABORATION_END.equals(chatMessageDto.messageType)) {
chatMessageDto.message = lastMessageInfoJSON.getJSONObject(ABookCommConstants.KEY.MESSAGE).toString();
} else {
chatMessageDto.message = lastMessageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
}
if (lastMessageInfoJSON.has(ABookCommConstants.KEY.INSERT_DATE)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(lastMessageInfoJSON.getJSONObject(ABookCommConstants.KEY.INSERT_DATE).getLong(ABookCommConstants.KEY.TIME));
}
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
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.JSONValidationException;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class UnreadCountJSON extends AcmsCommonJSON {
public ArrayList<ChatMessageDto> chatMessageDtoArrayList;
public UnreadCountJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// メッセージ情報を取得
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
HashMap<Integer, Integer> existShopMmeberMap = new HashMap<Integer, Integer>();
JSONArray unreadCountList = json.getJSONArray(ABookCommConstants.KEY.BODY);
if (unreadCountList == null) { return; }
chatMessageDtoArrayList = new ArrayList<ChatMessageDto>();
for (int listCount = 0; listCount < unreadCountList.length(); listCount++) {
ChatMessageDto chatMessageDto = new ChatMessageDto();
JSONObject messageInfoJSON = unreadCountList.getJSONObject(listCount);
if (messageInfoJSON == null) { continue; }
chatMessageDto.chatMessageId = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_ID);
chatMessageDto.unreadCount = messageInfoJSON.getInt(ABookCommConstants.KEY.UNREAD_COUNT);
chatMessageDtoArrayList.add(chatMessageDto);
}
}
}
......@@ -38,10 +38,9 @@ public class GetGroupInfoParameters extends HttpParameterObject {
this.cmd = cmd;
}
public GetGroupInfoParameters(String sid, String cmd, String groupId, String updatedDate) {
public GetGroupInfoParameters(String sid, String cmd, String updatedDate) {
this.sid = sid;
this.cmd = cmd;
this.groupIds = groupId;
this.updatedDate = updatedDate;
}
......
......@@ -17,6 +17,8 @@ public class GetMessagesParameters extends HttpParameterObject {
private String cmd;
private String roomId;
private String lineNum;
private String messageId;
private String updateDate;
/**
* {@link GetMessagesParameters} のインスタンスを初期化します。
......@@ -33,11 +35,13 @@ public class GetMessagesParameters extends HttpParameterObject {
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public GetMessagesParameters(String sid, String cmd, String roomId, String lineNum) {
public GetMessagesParameters(String sid, String cmd, String roomId, String lineNum, String messageId, String updateDate) {
this.sid = sid;
this.cmd = cmd;
this.roomId = roomId;
this.lineNum = lineNum;
this.messageId = messageId;
this.updateDate = updateDate;
}
/**
......@@ -66,4 +70,11 @@ public class GetMessagesParameters extends HttpParameterObject {
return lineNum;
}
public String getMessageId() {
return messageId;
}
public String getUpdateDate() {
return updateDate;
}
}
......@@ -188,10 +188,12 @@ public class AcmsApis {
public static final String getRoomList = "5";
public static final String createRoom = "2";
public static final String changeRoomName = "6";
public static final String getRoom = "7";
}
public static final class MessageCmds {
public static final String getMessages = "2";
public static final String getUnreadCount = "4";
}
public static final class FavoriteCmds {
......
......@@ -55,7 +55,7 @@ public interface ABookCommConstants {
String LAST_MESSAGE_INFO = "lastMessageInfo";
String FAVORITE_USER_IDS = "favoriteUserIds";
String FAVORITE_GROUP_IDS = "favoriteGroupIds";
String GROUP_INFO_LAST_UPDATE_DATE = "groupInfoLastUpdateDate";
String LAST_REQUEST_DATE = "lastRequestDate";
String ARCHIVE_INFO_LIST = "archiveInfoList";
String ARCHIVE_INFO = "archiveInfo";
......@@ -77,7 +77,13 @@ public interface ABookCommConstants {
String COLLABORATION_DEATAIL_ID = "collaborationDetailId";
String MY_SHOPE_MEMBER_ID = "myShopMemberId";
String ROOT_GROUP_ID = "rootGroupId";
String GROUP_MEMBER_UPDATED_DATE = "groupMemberUpdatedDate";
String MESSAGE_UPDATED_DATE = "MessageUpdatedDate";
String ARCHIVE_UPDATED_DATE = "ArchiveUpdatedDate";
String HTTP_STATUS = "httpStatus";
interface API_KIND {
String USER = "user";
......@@ -140,6 +146,7 @@ public interface ABookCommConstants {
interface SIZE {
Integer MAX_FAVORITE_COUNT = 100;
Integer MESSAGE_PAGING_SIZE = 20;
}
String FILE_SAVE_PATH = "/data/user/0/jp.co.agentec.abookplus.check/files/";
......
......@@ -161,7 +161,7 @@ public class ArchiveDao extends AbstractCommunicationDao {
}
public boolean updateArchiveDetailInfo(ArchiveDto dto) {
long count = update("update t_archive set archive_name=?, archive_type=?, archive_date=?, room_id=?, room_name=?, attend_user_ids=?, file_path=?, save_user_id=? where archive_id=?", dto.getUpdateDetailValues());
long count = update("update t_archive set room_name=? where archive_id=?", new String[]{"" + dto.roomName, "" + dto.archiveId});
return count > 0;
}
......
......@@ -283,6 +283,7 @@ public class ChatGroupDao extends AbstractCommunicationDao {
beginTransaction();
for (ChatGroupDto groupDto : groupList) {
update(sql.toString(), new Object[] { groupDto.groupId });
update("delete from r_shop_member_group where group_id = ? ", new Object[] { groupDto.groupId });
}
commit();
} catch (Exception e) {
......
......@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
......@@ -107,10 +108,41 @@ public class ChatMessageDao extends AbstractCommunicationDao {
sql.append(" ON cm.shop_member_id = sm.shop_member_id ");
sql.append(" WHERE cm.chat_room_id = ? ");
sql.append(" ORDER BY cm.insert_date DESC ");
sql.append(" LIMIT " + ABookCommConstants.SIZE.MESSAGE_PAGING_SIZE);
List<ChatMessageDto> list = rawQueryGetDtoList(sql.toString(), new String[]{""+ chatRoomId}, ChatMessageDto.class);
return list;
}
public List<ChatMessageDto> getChatMessageFromMessageId(int chatRoomId, String MessageId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" cm.chat_message_id ");
sql.append(" ,cm.chat_room_id ");
sql.append(" ,cm.shop_member_id ");
sql.append(" ,cm.login_id ");
sql.append(" ,cm.message ");
sql.append(" ,cm.message_type ");
sql.append(" ,cm.image_name ");
sql.append(" ,cm.download_file_name ");
sql.append(" ,cm.save_path ");
sql.append(" ,cm.insert_date ");
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url ");
sql.append(" ,sm.self_flg ");
sql.append(" ,cm.unread_count ");
sql.append(" FROM ");
sql.append(" t_chat_message AS cm ");
sql.append(" INNER JOIN ");
sql.append(" m_shop_member AS sm ");
sql.append(" ON cm.shop_member_id = sm.shop_member_id ");
sql.append(" WHERE cm.chat_room_id = ? ");
sql.append(" AND cm.chat_message_id < ? ");
sql.append(" ORDER BY cm.insert_date DESC ");
sql.append(" LIMIT " + ABookCommConstants.SIZE.MESSAGE_PAGING_SIZE);
List<ChatMessageDto> list = rawQueryGetDtoList(sql.toString(), new String[]{"" + chatRoomId, "" + MessageId}, ChatMessageDto.class);
return list;
}
public List<ChatMessageDto> searchChatMessage(int chatRoomId, String[] keywords, String userList) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
......@@ -177,6 +209,14 @@ public class ChatMessageDao extends AbstractCommunicationDao {
return count > 0;
}
public void updatUnreadCount(List<ChatMessageDto> messageDtoList) {
beginTransaction();
for (ChatMessageDto messageDto : messageDtoList) {
update("update t_chat_message set unread_count = ? where chat_message_id=?", new String[]{"" + messageDto.unreadCount, "" + messageDto.chatMessageId});
}
commit();
}
public void deleteChatMessage() {
try {
beginTransaction();
......
......@@ -188,9 +188,15 @@ public class ChatRoomDao extends AbstractCommunicationDao {
}
public void insertChatRoomUsers(List<Integer> attendUsers, Integer chatRoomId) {
if (CollectionUtil.isEmpty(attendUsers)) {
return;
}
String sql = "insert or replace into r_chat_room_shop_member (chat_room_id, shop_member_id) values ";
ArrayList<String> insertAttendUser = new ArrayList<String>();
for (Integer attendUserId : attendUsers) {
insert("insert or replace into r_chat_room_shop_member (chat_room_id, shop_member_id) values (?,?)", new Integer[]{chatRoomId, attendUserId});
insertAttendUser.add("(" + chatRoomId + ", " + attendUserId + ")");
}
insert(sql + StringUtil.join(", ", insertAttendUser), new Object[] {});
}
public void deleteChatRoomUsers(Integer chatRoomId) {
......
......@@ -2,6 +2,7 @@ package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
......@@ -69,10 +70,11 @@ public class ShopMemberDao extends AbstractCommunicationDao {
try {
beginTransaction();
insert("insert or replace into m_shop_member (shop_member_id, shop_member_name, login_id, profile_url, self_flg, favorite_register_date) values (?,?,?,?,?,(select favorite_register_date from m_shop_member where shop_member_id = ?))", dto.getInsertValues());
update(" delete from r_shop_member_group WHERE shop_member_id = ? ", new Integer[]{dto.shopMemberId});
for (Integer groupId : dto.groupIdList) {
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[]{groupId});
if (dto.groupIdList != null && dto.groupIdList.size() > 0) {
update(" delete from r_shop_member_group WHERE shop_member_id = ? ", new Integer[]{dto.shopMemberId});
for (Integer groupId : dto.groupIdList) {
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
}
commit();
} catch (Exception e) {
......@@ -102,6 +104,21 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
}
public void insertShopMemberGroupRelation(Integer groupId, List<ShopMemberDto> dtoList) {
try {
update("delete from r_shop_member_group where group_id = ? ", new Object[] { groupId });
for (ShopMemberDto dto : dtoList) {
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
} catch (Exception e) {
rollback();
Logger.e("insertShopMember failed.", e);
throw new RuntimeException(e);
} finally {
}
}
public ShopMemberDto getMyInfo() {
return rawQueryGetDto("select * from m_shop_member where self_flg = 1", null, ShopMemberDto.class);
}
......@@ -400,6 +417,17 @@ public class ShopMemberDao extends AbstractCommunicationDao {
return count > 0;
}
public void updateFavoriteUserList(List<Integer> shopMemberIdList) {
beginTransaction();
for (Integer shopMemberId : shopMemberIdList ) {
ShopMemberDto favoriteUserDto= new ShopMemberDto();
favoriteUserDto.shopMemberId = shopMemberId;
favoriteUserDto.favoriteRegisterDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(new Date(System.currentTimeMillis()));
update("update m_shop_member set favorite_register_date=? where shop_member_id=?", new Object[]{favoriteUserDto.favoriteRegisterDate, favoriteUserDto.shopMemberId});
}
commit();
}
public void deleteShopMember() {
try {
beginTransaction();
......
......@@ -9,6 +9,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
......@@ -126,6 +127,35 @@ public class CommunicationLogic extends AbstractLogic {
Map<String, Object> chatMessageMap = new HashMap<String, Object>();
chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId);
chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName);
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_ID, chatMessageDto.chatMessageId);
chatMessageMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, chatMessageDto.shopMemberId);
if (ABookCommConstants.FLAG.MESSAGE_TYPE.PHOTO.equals(chatMessageDto.messageType) || ABookCommConstants.FLAG.MESSAGE_TYPE.VIDEO.equals(chatMessageDto.messageType)) {
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, getFileUrlPath(chatMessageDto.message));
} else {
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, chatMessageDto.message);
}
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_TYPE, chatMessageDto.messageType);
chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate);
chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, getProfileUrlPath(chatMessageDto.profileUrl));
chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg);
chatMessageMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatMessageDto.unreadCount);
JSONObject jsonObject = new JSONObject(chatMessageMap);
resultJsonArray.put(jsonObject);
}
String messageListStr = resultJsonArray.toString();
return messageListStr;
}
public String getMessagesFromMessageId(Integer roomId, String messageId) {
List<ChatMessageDto> chatMessageDtoList = chatMessageDao.getChatMessageFromMessageId(roomId, messageId);
JSONArray resultJsonArray = new JSONArray();
for (ChatMessageDto chatMessageDto : chatMessageDtoList) {
Map<String, Object> chatMessageMap = new HashMap<String, Object>();
chatMessageMap.put(ABookCommConstants.KEY.CHAT_ROOM_ID, chatMessageDto.chatRoomId);
chatMessageMap.put(ABookCommConstants.KEY.LOGIN_ID, chatMessageDto.shopMemberName);
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE_ID, chatMessageDto.chatMessageId);
chatMessageMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, chatMessageDto.shopMemberId);
if (ABookCommConstants.FLAG.MESSAGE_TYPE.PHOTO.equals(chatMessageDto.messageType) || ABookCommConstants.FLAG.MESSAGE_TYPE.VIDEO.equals(chatMessageDto.messageType)) {
chatMessageMap.put(ABookCommConstants.KEY.MESSAGE, getFileUrlPath(chatMessageDto.message));
......@@ -762,7 +792,6 @@ public class CommunicationLogic extends AbstractLogic {
List<ShopMemberDto> deleteList = new ArrayList<ShopMemberDto>();
for (ShopMemberDto shopMemberDto : shopMemberDtoList) {
//TODO ユーザ最新化処理必要
//if (ABookCommConstants.FLAG.DEL_FLAG.EXIST.equals(shopMemberDto.delFlg)) {
if (myInfo.shopMemberId.equals(shopMemberDto.shopMemberId)) {
shopMemberDto.selfFlg = 1;
......@@ -778,6 +807,28 @@ public class CommunicationLogic extends AbstractLogic {
//shopMemberDao.deleteShopMemberByList(deleteList);
}
public void insertShopMemberByMap(HashMap<Integer, List<ShopMemberDto>> shopMemberDtoListMap) {
ShopMemberDto myInfo = shopMemberDao.getMyInfo();
List<ShopMemberDto> insertList = new ArrayList<ShopMemberDto>();
shopMemberDao.beginTransaction();
Set<Integer> groupIds = shopMemberDtoListMap.keySet();
for (Integer groupId : groupIds) {
List<ShopMemberDto> shopMemberDtoList = shopMemberDtoListMap.get(groupId);
for (ShopMemberDto shopMemberDto : shopMemberDtoList) {
if (myInfo.shopMemberId.equals(shopMemberDto.shopMemberId)) {
shopMemberDto.selfFlg = 1;
} else {
shopMemberDto.selfFlg = 0;
}
insertList.add(shopMemberDto);
}
shopMemberDao.insertShopMemberGroupRelation(groupId, shopMemberDtoList);
}
shopMemberDao.commit();
shopMemberDao.insertShopMember(insertList);
}
public void updateArchives(List<ArchiveDto> archiveDtoList) {
List<ArchiveDto> insertList = new ArrayList<ArchiveDto>();
List<ArchiveDto> deleteList = new ArrayList<ArchiveDto>();
......@@ -805,31 +856,31 @@ public class CommunicationLogic extends AbstractLogic {
}
public void updateGroup(List<ChatGroupDto> GroupList) {
List<ChatGroupDto> existGroupList = chatGroupDao.getAllGroups();
Map<Integer, ChatGroupDto> existGroupMap = convertGroupListToMap(existGroupList);
ArrayList<ChatGroupDto> insertGroupList = new ArrayList<ChatGroupDto>();
ArrayList<ChatGroupDto> deleteGroupList = new ArrayList<ChatGroupDto>();
ArrayList<ChatGroupDto> updateGroupList = new ArrayList<ChatGroupDto>();
HashMap<Integer, List<ShopMemberDto>> groupMembersMap = new HashMap<Integer, List<ShopMemberDto>>();
for (ChatGroupDto chatGroupDto : GroupList) {
if (chatGroupDto.delFlg == 1) {
deleteGroupList.add(chatGroupDto);
continue;
}
if (chatGroupDao.getGroup(chatGroupDto.groupId) == null) {
if (existGroupMap.get(chatGroupDto.groupId) == null) {
insertGroupList.add(chatGroupDto);
} else {
updateGroupList.add(chatGroupDto);
}
if (chatGroupDto.groupMembers == null) {
continue;
}
insertShopMember(chatGroupDto.groupMembers);
groupMembersMap.put(chatGroupDto.groupId, chatGroupDto.groupMembers);
}
chatGroupDao.insertGroupList(insertGroupList);
chatGroupDao.updateGroupList(updateGroupList);
chatGroupDao.deleteGroupList(deleteGroupList);
insertShopMemberByMap(groupMembersMap);
}
public ShopMemberDto getMyShopMemberDto() {
......@@ -847,12 +898,7 @@ public class CommunicationLogic extends AbstractLogic {
}
public void updateFavoriteUser(List<Integer> favoriteUserIds){
for (Integer favoriteUserId : favoriteUserIds) {
ShopMemberDto favoriteUserDto= new ShopMemberDto();
favoriteUserDto.shopMemberId = favoriteUserId;
favoriteUserDto.favoriteRegisterDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(new Date(System.currentTimeMillis()));
shopMemberDao.updateFavoriteUser(favoriteUserDto);
}
shopMemberDao.updateFavoriteUserList(favoriteUserIds);
}
public void updateFavoriteGroup(List<Integer> favoriteGroupIds){
......@@ -1064,4 +1110,16 @@ public class CommunicationLogic extends AbstractLogic {
}
return resultJsonArray.toString();
}
public Map<Integer, ChatGroupDto> convertGroupListToMap(List<ChatGroupDto> groupList) {
Map<Integer, ChatGroupDto> map = new HashMap<Integer, ChatGroupDto>();
for (ChatGroupDto group : groupList) {
map.put(group.groupId, group);
}
return map;
}
public void updateUnreadCount(List<ChatMessageDto> messageList) {
chatMessageDao.updatUnreadCount(messageList);
}
}
......@@ -76,7 +76,9 @@ import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteUserJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MessageInfoListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MyInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UnreadCountJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UserInviteResultJSON;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
......@@ -232,7 +234,6 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
communicationLogic.initChatData();
try {
updateMyInfoFromServer();
updateAllGroupInfo();
......@@ -250,6 +251,7 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
});
closeProgressPopup();
} catch (Exception e) {
e.printStackTrace();
Logger.d("Update error");
}
}
......@@ -1049,8 +1051,9 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
public void updateRoomList() throws NetworkDisconnectedException, AcmsException {
Map<String, Object> chatRoomList;
RoomListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoomList(sid);
//communicationLogic.deleteChatRoomList();
communicationLogic.insertChatRoomList(resultJson.roomList);
}
@JavascriptInterface
......@@ -1059,14 +1062,8 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
}
@JavascriptInterface
public void updateGroupInfo(String groupId) throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer(groupId);
}
@JavascriptInterface
public void updateGroupUser() throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer(communicationLogic.getMyGroupIds());
updateGroupInfoFromServer();
}
@JavascriptInterface
......@@ -1185,12 +1182,18 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
@JavascriptInterface
public void updateMessages(String roomId) throws NetworkDisconnectedException, AcmsException {
MessageInfoListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessages(sid, roomId);
SharedPreferences pref = getSharedPreferences(ABookCommConstants.TAG, MODE_PRIVATE);
String lastUpdatedDate = pref.getString(ABookCommConstants.KEY.MESSAGE_UPDATED_DATE + roomId, DEFAULT_CHECKSUM);
MessageInfoListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessages(sid, roomId, null, lastUpdatedDate);
for (ChatMessageDto chatMessageDto : resultJson.chatMessageDtoArrayList) {
chatMessageDto.chatRoomId = Integer.parseInt(roomId);
}
communicationLogic.insertMessageList(resultJson.chatMessageDtoArrayList);
communicationLogic.insertShopMember(resultJson.shopMemberDtoArrayList);
updateUnreadCount();
SharedPreferences.Editor editor = pref.edit();
editor.putString(ABookCommConstants.KEY.MESSAGE_UPDATED_DATE + roomId, resultJson.updateDate);
editor.commit();
}
@JavascriptInterface
......@@ -1439,13 +1442,12 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
@JavascriptInterface
public void updateArchiveList() throws NetworkDisconnectedException, AcmsException {
SharedPreferences pref = getSharedPreferences(ABookCommConstants.TAG, MODE_PRIVATE);
String updateDate = pref.getString(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE, DEFAULT_CHECKSUM);
String updateDate = pref.getString(ABookCommConstants.KEY.ARCHIVE_UPDATED_DATE, DEFAULT_CHECKSUM);
ArchiveListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getArchives(sid, updateDate);
communicationLogic.updateArchives(resultJson.archiveList);
if (StringUtil.isNullOrEmpty(resultJson.archiveLastUpdateDate)) { return; }
SharedPreferences.Editor editor = pref.edit();
editor.putString(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE, resultJson.archiveLastUpdateDate);
editor.putString(ABookCommConstants.KEY.ARCHIVE_UPDATED_DATE, resultJson.archiveLastUpdateDate);
editor.commit();
}
......@@ -1483,12 +1485,9 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
@JavascriptInterface
public void updateArchiveDetail(String archiveId) throws NetworkDisconnectedException, AcmsException {
ArchiveDto archiveDto = communicationLogic.getArchive(Integer.parseInt(archiveId));
ArchiveDetailJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getArchiveDetail(sid, Integer.parseInt(archiveId), archiveDto.collaborationDetailId);
if (resultJson.archiveDto == null) {
return;
}
communicationLogic.updateArchiveDetial(resultJson.archiveDto);
RoomJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoom(sid, archiveDto.roomId.toString());
archiveDto.roomName = resultJson.chatRoomDto.chatRoomName;
communicationLogic.updateArchiveDetial(archiveDto);
}
@JavascriptInterface
......@@ -1673,6 +1672,23 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
public void finishPip() {
finishPIPmode();
}
@JavascriptInterface
public void updatePreMessage(String messageId) throws NetworkDisconnectedException, AcmsException {
if (messageId.equals("0")) {
return;
}
updateMessageFromMessageId(messageId);
}
@JavascriptInterface
public String getMessageListFromMessageId(String messageId) {
if (messageId.equals("0")) {
return "";
}
String messageListStr = communicationLogic.getMessagesFromMessageId(roomId.intValue(), messageId);
return messageListStr;
}
}
/**
......@@ -1809,30 +1825,16 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return true;
}
private void updateGroupInfoFromServer(String groupIds) throws NetworkDisconnectedException, AcmsException {
private void updateGroupInfoFromServer() throws NetworkDisconnectedException, AcmsException {
ArrayList<String> checkSumList = new ArrayList<String>();
SharedPreferences pref = getSharedPreferences(ABookCommConstants.TAG, MODE_PRIVATE);
for (String groupId : groupIds.split(",")) {
//checkSumList.add(pref.getString(groupId,DEFAULT_CHECKSUM));
checkSumList.add(DEFAULT_CHECKSUM);
}
String checkSumListStr = StringUtil.join(",",checkSumList);
if (groupIds.equals(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString())) {
checkSumListStr = DEFAULT_CHECKSUM;
}
String lastUpdatedDate = pref.getString(ABookCommConstants.KEY.GROUP_MEMBER_UPDATED_DATE, DEFAULT_CHECKSUM);
try {
GroupListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getGroupInfo(sid,groupIds,checkSumListStr);
GroupListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getGroupInfo(sid, lastUpdatedDate);
if (CollectionUtil.isNotEmpty(resultJson.groupList)) {
SharedPreferences.Editor editor = pref.edit();
communicationLogic.updateGroup(resultJson.groupList);
if (groupIds.equals(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString())) {
editor.putString(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString(),resultJson.allGroupLastUpdateDate);
} else {
for (ChatGroupDto groupDto : resultJson.groupList) {
editor.putString(Integer.toString(groupDto.groupId),groupDto.updateDate);
}
}
SharedPreferences.Editor editor = pref.edit();
editor.putString(ABookCommConstants.KEY.GROUP_MEMBER_UPDATED_DATE, resultJson.lastRequestDate);
editor.commit();
}
} catch (AcmsException e) {
......@@ -1846,18 +1848,15 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
communicationLogic.updateFavoriteUser(resultJson.favoriteUserIds);
}
private void updateFavoriteGroup() throws NetworkDisconnectedException, AcmsException {
GetFavoriteGroupJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getFavoriteGroup(sid);
communicationLogic.updateFavoriteGroup(resultJson.favoriteGroupIds);
}
private void updateAllGroupInfo() throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString());
List<ChatGroupDto> groupList = communicationLogic.getAllGroup();
for (ChatGroupDto group : groupList) {
updateGroupInfoFromServer(Integer.toString(group.groupId));
}
updateGroupInfoFromServer();
}
private void updateFavoriteInfo() throws NetworkDisconnectedException, AcmsException {
......@@ -2008,4 +2007,19 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
json.put(MeetingManager.LOGIN_ID, ABVDataCache.getInstance().getMemberInfo().loginId);
meetingManager.sendWs(MeetingManager.CMD_PRESENTERREQUEST, contentViewActivity != null ? contentViewActivity.getContentId() : 0, null, null, json);
}
public void updateUnreadCount() throws NetworkDisconnectedException, AcmsException {
UnreadCountJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessagesUnreadCount(sid, Integer.toString(roomId.intValue()));
communicationLogic.updateUnreadCount(resultJson.chatMessageDtoArrayList);
}
public void updateMessageFromMessageId(String messageId) throws NetworkDisconnectedException, AcmsException {
MessageInfoListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessages(sid, Integer.toString(roomId.intValue()), messageId, null);
for (ChatMessageDto chatMessageDto : resultJson.chatMessageDtoArrayList) {
chatMessageDto.chatRoomId = roomId.intValue();
}
communicationLogic.insertMessageList(resultJson.chatMessageDtoArrayList);
communicationLogic.insertShopMember(resultJson.shopMemberDtoArrayList);
updateUnreadCount();
}
}
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