Commit c10ae0b2 by Lee Munkyeong

Merge branch 'features/abcomm_sp3_contactUI' into 'features/abcomm_sp3'

Features/abcomm sp3 contact ui

See merge request !93
parents 5c0f9497 74d0da9c
...@@ -21,9 +21,13 @@ import jp.agentec.abook.abv.bl.acms.client.json.CategoriesJSON; ...@@ -21,9 +21,13 @@ import jp.agentec.abook.abv.bl.acms.client.json.CategoriesJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ChatPushDataJSON; import jp.agentec.abook.abv.bl.acms.client.json.ChatPushDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ContentCheckDeliverableJSON; import jp.agentec.abook.abv.bl.acms.client.json.ContentCheckDeliverableJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON; import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON; import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupsJSON; import jp.agentec.abook.abv.bl.acms.client.json.GroupsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON; import jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON;
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.NewAppStoreLoginJSON; import jp.agentec.abook.abv.bl.acms.client.json.NewAppStoreLoginJSON;
import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON; import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.OperationGroupMasterJSON; import jp.agentec.abook.abv.bl.acms.client.json.OperationGroupMasterJSON;
...@@ -50,6 +54,9 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseNewLoginParamete ...@@ -50,6 +54,9 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseNewLoginParamete
import jp.agentec.abook.abv.bl.acms.client.parameters.GetApertureMasterDataParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetApertureMasterDataParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetContentParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetContentParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetEnqueteReplyParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetEnqueteReplyParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetGroupInfoParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetMessagesParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetNameCardParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters;
...@@ -58,6 +65,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.PostEnqueteReplyParameters ...@@ -58,6 +65,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.PostEnqueteReplyParameters
import jp.agentec.abook.abv.bl.acms.client.parameters.SendPushMessageParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.SendPushMessageParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ServerTimeParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.ServerTimeParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.UpdateDeviceTokenParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.UpdateDeviceTokenParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.CreateRoomParameters;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis; import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.acms.type.LoginStatus; import jp.agentec.abook.abv.bl.acms.type.LoginStatus;
import jp.agentec.abook.abv.bl.acms.type.RequirePasswordChangeCode; import jp.agentec.abook.abv.bl.acms.type.RequirePasswordChangeCode;
...@@ -534,10 +542,86 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -534,10 +542,86 @@ 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.Cmds.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;
}
/**
* ログインしたユーザの情報を取得する。
*
* @param sid
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public MyInfoJSON getMyInfo(String sid) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetUser, new AcmsParameters(sid, AcmsApis.UserCmds.getMyInfo));
MyInfoJSON json = new MyInfoJSON(response.httpResponseBody);
return json;
}
/**
* サーバよりネームカード情報取得。
*
* @param sid
* @param shopMemberId
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public MyInfoJSON getNameCard(String sid, String shopMemberId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetUser, new GetNameCardParameters(sid, AcmsApis.UserCmds.getNameCard, shopMemberId));
MyInfoJSON json = new MyInfoJSON(response.httpResponseBody);
return json;
}
/**
* 全てのグループ更新。
*
* @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));
GroupListJSON json = new GroupListJSON(response.httpResponseBody);
return json;
}
/**
* ルーム作成。
*
* @param sid
* @param roomType
* @param inviteMemberIds
* @param newRoomName
* @return
* @throws NetworkDisconnectedException
* @throws 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));
CreatedRoomJSON json = new CreatedRoomJSON(response.httpResponseBody);
return json;
}
/**
* ルーム作成。
*
* @param sid
* @param roomId
* @return
* @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"));
MessageInfoListJSON json = new MessageInfoListJSON(response.httpResponseBody);
return json;
} }
/** /**
......
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.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
public class CreatedRoomJSON extends AcmsCommonJSON {
public ArrayList<ShopMemberDto> attendUsers;
public ChatRoomDto chatRoomDto;
public CreatedRoomJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONObject createdRoomJson = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONObject(ABookCommConstants.KEY.CHAT_ROOM_INFO);
if (createdRoomJson == null) { return; }
JSONArray groupListJsonArray = createdRoomJson.getJSONArray(ABookCommConstants.KEY.ATTEND_USERS);
chatRoomDto = new ChatRoomDto();
chatRoomDto.userCount = groupListJsonArray.length();
chatRoomDto.chatRoomId = createdRoomJson.getInt(ABookCommConstants.KEY.ROOM_ID);
chatRoomDto.chatRoomName = createdRoomJson.getString(ABookCommConstants.KEY.ROOM_NAME);
chatRoomDto.type = createdRoomJson.getInt(ABookCommConstants.KEY.ROOM_TYPE);
}
}
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.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeUtil;
public class GroupListJSON extends AcmsCommonJSON {
public ArrayList<GroupDto> groupList;
public GroupListJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONArray groupListJsonArray = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONArray(ABookCommConstants.KEY.GROUP_INFO_LIST);
if (groupListJsonArray == null) { return; }
groupList = new ArrayList<GroupDto>();
for (int listCount = 0; listCount < groupListJsonArray.length(); listCount++) {
if (groupListJsonArray.getJSONObject(listCount).length() == 0) {
break;
}
JSONObject groupJSON = groupListJsonArray.getJSONObject(listCount);
GroupDto groupDto = new GroupDto();
groupDto.groupId = groupJSON.getInt(ABookCommConstants.KEY.GROUP_ID);
if (groupJSON.has(ABookCommConstants.KEY.PARENT_GROUP_ID)) {
groupDto.parentGroupId = groupJSON.getInt(ABookCommConstants.KEY.PARENT_GROUP_ID);
}
groupDto.groupName = groupJSON.getString(ABookCommConstants.KEY.GROUP_NAME);
groupDto.delFlg = groupJSON.getInt(ABookCommConstants.KEY.DEL_FLG);
if (groupJSON.has(ABookCommConstants.KEY.GROUP_MEMBER_LIST)) {
JSONArray groupMemberJsonArray = groupJSON.getJSONArray(ABookCommConstants.KEY.GROUP_MEMBER_LIST);
ArrayList<ShopMemberDto> groupMembers = new ArrayList<ShopMemberDto>();
for (int groupMemberCount = 0; groupMemberCount < groupMemberJsonArray.length(); groupMemberCount++) {
JSONObject groupMember = groupMemberJsonArray.getJSONObject(groupMemberCount);
ShopMemberDto shopMemberDto = new ShopMemberDto();
shopMemberDto.shopMemberId = groupMember.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
shopMemberDto.shopMemberName = groupMember.getString(ABookCommConstants.KEY.MEMBER_NAME);
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);
}
}
}
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.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeUtil;
public class MessageInfoListJSON extends AcmsCommonJSON {
public ArrayList<ChatMessageDto> chatMessageDtoArrayList;
public ArrayList<ShopMemberDto> shopMemberDtoArrayList;
public MessageInfoListJSON(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 messageInfoList = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONArray(ABookCommConstants.KEY.MESSAGE_INFO_LIST);
if (messageInfoList == null) { return; }
chatMessageDtoArrayList = new ArrayList<ChatMessageDto>();
shopMemberDtoArrayList = new ArrayList<ShopMemberDto>();
for (int listCount = 0; listCount < messageInfoList.length(); listCount++) {
if (messageInfoList.getJSONObject(listCount).length() == 0) {
break;
}
ChatMessageDto chatMessageDto = new ChatMessageDto();
JSONObject messageInfoJSON = messageInfoList.getJSONObject(listCount);
if (messageInfoJSON == null) { continue; }
chatMessageDto.shopMemberId = messageInfoJSON.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
chatMessageDto.chatMessageId = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_ID);
chatMessageDto.message = messageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
chatMessageDto.messageType = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_TYPE);
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);
shopMemberDto.shopMemberName = messageInfoJSON.getString(ABookCommConstants.KEY.MEMBER_NAME);
if (messageInfoJSON.has(ABookCommConstants.KEY.PROFILE_IMAGE_PATH)) {
shopMemberDto.profileUrl = messageInfoJSON.getString(ABookCommConstants.KEY.PROFILE_IMAGE_PATH);
}
existShopMmeberMap.put(shopMemberDto.shopMemberId,shopMemberDto.shopMemberId);
shopMemberDtoArrayList.add(shopMemberDto);
}
}
}
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.ShopMemberDto;
public class MyInfoJSON extends AcmsCommonJSON {
public ShopMemberDto shopMemberDto;
public MyInfoJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONObject MyInfoJson = json.getJSONObject(ABookCommConstants.KEY.BODY);
if (MyInfoJson == null) { return; }
shopMemberDto = new ShopMemberDto();
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.selfFlg = ABookCommConstants.FLAG.SELF_FLAG.ON;
shopMemberDto.profileUrl = MyInfoJson.getString(ABookCommConstants.KEY.PROFILE_IMAGE_PATH);
shopMemberDto.shopMemberId = MyInfoJson.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
shopMemberDto.shopMemberName = MyInfoJson.getString(ABookCommConstants.KEY.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);
......
...@@ -15,6 +15,9 @@ public class AcmsParameters extends HttpParameterObject { ...@@ -15,6 +15,9 @@ public class AcmsParameters extends HttpParameterObject {
*/ */
private String sid; private String sid;
private String cmd; private String cmd;
private String groupId;
private String updatedDate;
/** /**
* {@link AcmsParameters} のインスタンスを初期化します。 * {@link AcmsParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。 * @param sid ログインした時のセッションIDです。
...@@ -35,6 +38,13 @@ public class AcmsParameters extends HttpParameterObject { ...@@ -35,6 +38,13 @@ public class AcmsParameters extends HttpParameterObject {
this.cmd = cmd; this.cmd = cmd;
} }
public AcmsParameters(String sid, String cmd, String groupId, String updatedDate) {
this.sid = sid;
this.cmd = cmd;
this.groupId = groupId;
this.updatedDate = updatedDate;
}
/** /**
* セッションIDを返します。 * セッションIDを返します。
* @return ログインした時のセッションIDです。 * @return ログインした時のセッションIDです。
...@@ -52,4 +62,12 @@ public class AcmsParameters extends HttpParameterObject { ...@@ -52,4 +62,12 @@ public class AcmsParameters extends HttpParameterObject {
public String getCmd() { public String getCmd() {
return cmd; return cmd;
} }
public String getUpdatedDate() {
return updatedDate;
}
public String getGroupId() {
return groupId;
}
} }
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link CreateRoomParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author Taejin Hong
* @version 1.0.0
*/
public class CreateRoomParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private String roomType;
private String inviteMemberIds;
private String newRoomName;
/**
* {@link CreateRoomParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @since 1.0.0
*/
public CreateRoomParameters(String sid) {
this.sid = sid;
}
/**
* {@link CreateRoomParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public CreateRoomParameters(String sid, String cmd, String roomType, String inviteMemberIds, String newRoomName) {
this.sid = sid;
this.cmd = cmd;
this.roomType = roomType;
this.inviteMemberIds = inviteMemberIds;
this.newRoomName = newRoomName;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
public String getRoomType() {
return roomType;
}
public String getInviteMemberIds() {
return inviteMemberIds;
}
public String getNewRoomName() {
return newRoomName;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link GetGroupInfoParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author Taejin Hong
* @version 1.0.0
*/
public class GetGroupInfoParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private String groupIds;
private String updatedDate;
/**
* {@link GetGroupInfoParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @since 1.0.0
*/
public GetGroupInfoParameters(String sid) {
this.sid = sid;
}
/**
* {@link GetGroupInfoParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public GetGroupInfoParameters(String sid, String cmd) {
this.sid = sid;
this.cmd = cmd;
}
public GetGroupInfoParameters(String sid, String cmd, String groupId, String updatedDate) {
this.sid = sid;
this.cmd = cmd;
this.groupIds = groupId;
this.updatedDate = updatedDate;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
public String getUpdatedDate() {
return updatedDate;
}
public String getGroupIds() {
return groupIds;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link GetMessagesParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author Taejin Hong
* @version 1.0.0
*/
public class GetMessagesParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private String roomId;
private String lineNum;
/**
* {@link GetMessagesParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @since 1.0.0
*/
public GetMessagesParameters(String sid) {
this.sid = sid;
}
/**
* {@link GetMessagesParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public GetMessagesParameters(String sid, String cmd, String roomId, String lineNum) {
this.sid = sid;
this.cmd = cmd;
this.roomId = roomId;
this.lineNum = lineNum;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
public String getRoomId() {
return roomId;
}
public String getLineNum() {
return lineNum;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link GetNameCardParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author Taejin Hong
* @version 1.0.0
*/
public class GetNameCardParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private String nameCardMemberId;
/**
* {@link GetNameCardParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @since 1.0.0
*/
public GetNameCardParameters(String sid) {
this.sid = sid;
}
/**
* {@link GetNameCardParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @param nameCardMemberId 対象ユーザID。
* @since 1.0.0
*/
public GetNameCardParameters(String sid, String cmd, String nameCardMemberId) {
this.sid = sid;
this.cmd = cmd;
this.nameCardMemberId = nameCardMemberId;
}
public String getSid() {
return sid;
}
public String getCmd() {
return cmd;
}
public String getNameCardMemberId() {
return nameCardMemberId;
}
}
...@@ -171,9 +171,22 @@ public class AcmsApis { ...@@ -171,9 +171,22 @@ public class AcmsApis {
public static final String ChatApiUrlFormat = "%s/%s/chatapi/%s/"; public static final String ChatApiUrlFormat = "%s/%s/chatapi/%s/";
public static final String ApiGetChatPushData = "push"; public static final String ApiGetChatPushData = "push";
public static final String ApigetChatRooms = "room"; public static final String ApigetChatRooms = "room";
public static final String ApigetUser = "user";
public static final String ApigetMessage = "message";
public static final class Cmds { public static final class UserCmds {
public static final String getMyInfo = "9";
public static final String getGroupInfo = "10";
public static final String getNameCard = "11";
}
public static final class RoomCmds {
public static final String getRoomList = "5"; public static final String getRoomList = "5";
public static final String createRoom = "2";
}
public static final class MessageCmds {
public static final String getMessages = "2";
} }
// download // download
...@@ -222,7 +235,7 @@ public class AcmsApis { ...@@ -222,7 +235,7 @@ public class AcmsApis {
methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiGetApertureMasterData) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision) methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiGetApertureMasterData) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision)
|| methodName.equals(ApiGetProcessData) || methodName.equals(ApiDeleteProcess)) { || methodName.equals(ApiGetProcessData) || methodName.equals(ApiDeleteProcess)) {
apiValue = Constant.ApiValue.checkapi; apiValue = Constant.ApiValue.checkapi;
} else if (methodName.equals(ApiGetChatPushData) || methodName.equals(ApigetChatRooms)) { // pushActionはchatapiを指定 } else if (methodName.equals(ApiGetChatPushData) || methodName.equals(ApigetChatRooms) || methodName.equals(ApigetUser) || methodName.equals(ApigetMessage)) { // pushActionはchatapiを指定
apiValue = Constant.ApiValue.chatapi; apiValue = Constant.ApiValue.chatapi;
} }
......
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;
}
}
}
...@@ -371,7 +371,35 @@ public class AbstractDao { ...@@ -371,7 +371,35 @@ public class AbstractDao {
} }
} }
} }
/**
* クエリを実行し、最初の行の最初の列の値をString型リストで返します。
*
* @param sql
* @param bindArgs
* @return
*/
public List<String> rawQueryGetStringList(String sql, String[] bindArgs) {
SQLiteDatabase db = dbConn.getDatabase();
Cursor cursor = null;
try {
List<String> list = new ArrayList<String>();
if (Logger.isVerboseEnabled()) {
Logger.v(TAG, "%s [%s]", sql, join(bindArgs));
}
cursor = db.rawQuery(sql, bindArgs);
while (cursor.moveToNext()) {
list.add(cursor.getString(0));
}
return list;
}
finally {
if (cursor != null) {
cursor.close();
}
}
}
/** /**
* クエリを実行し、DTOのリストとして返却します。 * クエリを実行し、DTOのリストとして返却します。
* cursorからDTOへの変換は、convertメソッドを使用するため、当該Daoはconvert()メソッドを実装する必要があります。 * cursorからDTOへの変換は、convertメソッドを使用するため、当該Daoはconvert()メソッドを実装する必要があります。
......
...@@ -56,18 +56,51 @@ public class ChatMessageDao extends AbstractDao { ...@@ -56,18 +56,51 @@ public class ChatMessageDao extends AbstractDao {
} }
column = cursor.getColumnIndex("insert_date"); column = cursor.getColumnIndex("insert_date");
if (column != -1) { if (column != -1) {
dto.savePath = cursor.getString(column); dto.insertDate = cursor.getString(column);
}
column = cursor.getColumnIndex("shop_member_name");
if (column != -1) {
dto.shopMemberName = cursor.getString(column);
}
column = cursor.getColumnIndex("profile_url");
if (column != -1) {
dto.profileUrl = cursor.getString(column);
}
column = cursor.getColumnIndex("self_flg");
if (column != -1) {
dto.selfFlg = cursor.getInt(column);
} }
return dto; return dto;
} }
public List<ChatMessageDto> getChatMessage(int chatRoomId) { public List<ChatMessageDto> getChatMessage(int chatRoomId) {
List<ChatMessageDto> list = rawQueryGetDtoList("select * from t_chat_message where chat_room_id = ?", new String[]{""+ chatRoomId}, ChatMessageDto.class); 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.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(" 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(" ORDER BY cm.insert_date DESC ");
List<ChatMessageDto> list = rawQueryGetDtoList(sql.toString(), new String[]{""+ chatRoomId}, ChatMessageDto.class);
return list; return list;
} }
public void insertChatMessage(ChatMessageDto dto) { public void insertChatMessage(ChatMessageDto dto) {
insert("insert into t_chat_message (chat_message_id, chat_room_id, shop_member_id, message, message_type, image_name, download_file_name, save_path, insert_date) values (?,?,?,?,?,?,?,?,?)", dto.getInsertValues()); insert("insert or replace into t_chat_message (chat_message_id, chat_room_id, shop_member_id, message, message_type, image_name, download_file_name, save_path, insert_date) values (?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
} }
public void insertChatMessage(List<ChatMessageDto> chatMessageDtoList) { public void insertChatMessage(List<ChatMessageDto> chatMessageDtoList) {
......
...@@ -62,7 +62,7 @@ public class ChatRoomDao extends AbstractDao { ...@@ -62,7 +62,7 @@ public class ChatRoomDao extends AbstractDao {
return dto; return dto;
} }
public List<ChatRoomDto> getAllChatRoom() { public List<ChatRoomDto> getAllChatRoom(Integer roomType) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" SELECT "); sql.append(" SELECT ");
sql.append(" cr.chat_room_id "); sql.append(" cr.chat_room_id ");
...@@ -79,9 +79,10 @@ public class ChatRoomDao extends AbstractDao { ...@@ -79,9 +79,10 @@ public class ChatRoomDao extends AbstractDao {
sql.append(" LEFT JOIN "); sql.append(" LEFT JOIN ");
sql.append(" ( SELECT max(insert_date) insert_date, message, message_type, chat_room_id FROM t_chat_message GROUP BY chat_room_id ) AS cm "); sql.append(" ( SELECT max(insert_date) insert_date, message, message_type, chat_room_id FROM t_chat_message GROUP BY chat_room_id ) AS cm ");
sql.append(" ON cr.chat_room_id = cm.chat_room_id "); sql.append(" ON cr.chat_room_id = cm.chat_room_id ");
sql.append(" WHERE cr.type =? ");
sql.append(" GROUP BY cr.chat_room_id "); sql.append(" GROUP BY cr.chat_room_id ");
sql.append(" ORDER BY cm.insert_date DESC "); sql.append(" ORDER BY unread_count, cm.insert_date DESC ");
List<ChatRoomDto> list = rawQueryGetDtoList(sql.toString(), null, ChatRoomDto.class); List<ChatRoomDto> list = rawQueryGetDtoList(sql.toString(), new String[]{""+ roomType}, ChatRoomDto.class);
return list; return list;
} }
...@@ -94,7 +95,7 @@ public class ChatRoomDao extends AbstractDao { ...@@ -94,7 +95,7 @@ public class ChatRoomDao extends AbstractDao {
} }
public void insertChatRoom(ChatRoomDto dto) { public void insertChatRoom(ChatRoomDto dto) {
insert("insert into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date) values (?,?,?,?,?,?)", dto.getInsertValues()); insert("insert or replace into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date) values (?,?,?,?,?,?)", dto.getInsertValues());
} }
public void insertChatRoom(List<ChatRoomDto> chatRoomDtoList) { public void insertChatRoom(List<ChatRoomDto> chatRoomDtoList) {
...@@ -121,7 +122,6 @@ public class ChatRoomDao extends AbstractDao { ...@@ -121,7 +122,6 @@ public class ChatRoomDao extends AbstractDao {
beginTransaction(); beginTransaction();
delete("t_chat_room", null, null); delete("t_chat_room", null, null);
delete("r_chat_room_shop_member", null, null); delete("r_chat_room_shop_member", null, null);
delete("t_chat_message", null, null);
commit(); commit();
} catch (Exception e) { } catch (Exception e) {
rollback(); rollback();
......
...@@ -59,7 +59,10 @@ public class GroupDao extends AbstractDao { ...@@ -59,7 +59,10 @@ public class GroupDao extends AbstractDao {
if (column != -1) { if (column != -1) {
dto.userGroupFlg = toBool(cursor.getInt(column)); dto.userGroupFlg = toBool(cursor.getInt(column));
} }
column = cursor.getColumnIndex("favorite_register_date");
if (column != -1) {
dto.favoriteRegisterDate = cursor.getString(column);
}
return dto; return dto;
} }
...@@ -71,7 +74,22 @@ public class GroupDao extends AbstractDao { ...@@ -71,7 +74,22 @@ public class GroupDao extends AbstractDao {
public List<GroupDto> getExistContentGroup(long contentId) { public List<GroupDto> getExistContentGroup(long contentId) {
return rawQueryGetDtoList("select * from m_group where group_relation_id in (select group_relation_id from r_content_group where content_id = " + contentId + ") order by group_id", null, GroupDto.class); return rawQueryGetDtoList("select * from m_group where group_relation_id in (select group_relation_id from r_content_group where content_id = " + contentId + ") order by group_id", null, GroupDto.class);
} }
public List<String> getMyGroupPathList() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" CASE WHEN (grandparentgroup.group_name IS NOT NULL) THEN grandparentgroup.group_name || ' / ' || parentgroup.group_name || ' / ' || mygroup.group_name ");
sql.append(" WHEN (parentgroup.group_name IS NOT NULL) THEN parentgroup.group_name || ' / ' || mygroup.group_name ");
sql.append(" ELSE mygroup.group_name ");
sql.append(" END AS group_path_list ");
sql.append(" FROM m_group mygroup ");
sql.append(" LEFT JOIN m_group parentgroup on mygroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE mygroup.user_group_flg = 1 ");
return rawQueryGetStringList(sql.toString(), null);
}
private String generateGetGroupsQuery(QueryType queryType, int[] groupRelationids, int[] parentGroupIds, Boolean downloaded, String searchKeyword, SearchDivisionType searchDivisionType, boolean isOnlineSearched) { private String generateGetGroupsQuery(QueryType queryType, int[] groupRelationids, int[] parentGroupIds, Boolean downloaded, String searchKeyword, SearchDivisionType searchDivisionType, boolean isOnlineSearched) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
...@@ -478,13 +496,33 @@ public class GroupDao extends AbstractDao { ...@@ -478,13 +496,33 @@ public class GroupDao extends AbstractDao {
public GroupDto getGroup(int groupId) { public GroupDto getGroup(int groupId) {
return rawQueryGetDto("select * from m_group where group_id = " + groupId, null, GroupDto.class); return rawQueryGetDto("select * from m_group where group_id = " + groupId, null, GroupDto.class);
} }
public List<GroupDto> getFavoriteGroup() {
return rawQueryGetDtoList("select * from m_group where favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, GroupDto.class);
}
public List<GroupDto> getGroupSpareList(int baseId, int parentId) { public List<GroupDto> getGroupSpareList(int baseId, int parentId) {
List<GroupDto> list; List<GroupDto> list;
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);
...@@ -512,4 +550,77 @@ public class GroupDao extends AbstractDao { ...@@ -512,4 +550,77 @@ public class GroupDao extends AbstractDao {
return userGroupList.get(0).groupId; return userGroupList.get(0).groupId;
} }
public void insertGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" INSERT INTO m_group (group_id, parent_group_id, group_name, group_path, group_level, user_group_flg) ");
sql.append(" VALUES (?,?,?,?,?,?) ");
try {
beginTransaction();
for (GroupDto groupDto : groupList) {
insert(sql.toString(), new Object[] { groupDto.groupId, groupDto.parentGroupId, groupDto.groupName, ""+ groupDto.groupId, 0, 0 });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("insertGroupList failed.", e);
throw new RuntimeException(e);
}
}
public void updateGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_group ");
sql.append(" SET group_name = ? ");
sql.append(" , parent_group_id = ? ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (GroupDto groupDto : groupList) {
update(sql.toString(), new Object[] { groupDto.groupName, groupDto.parentGroupId, groupDto.groupId });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("updateGroupList failed.", e);
throw new RuntimeException(e);
}
}
public void updateFavoriteGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_group ");
sql.append(" , favorite_register_date = ? ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (GroupDto groupDto : groupList) {
update(sql.toString(), new Object[] { groupDto.favoriteRegisterDate, groupDto.groupId });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("updateFavoriteGroupList failed.", e);
throw new RuntimeException(e);
}
}
public void deleteGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" delete from m_group ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (GroupDto groupDto : groupList) {
update(sql.toString(), new Object[] { groupDto.groupId });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteGroupList failed.", e);
throw new RuntimeException(e);
}
}
} }
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor; import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto; import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto; import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeFormat; import jp.agentec.adf.util.DateTimeFormat;
...@@ -41,6 +42,10 @@ public class ShopMemberDao extends AbstractDao { ...@@ -41,6 +42,10 @@ public class ShopMemberDao extends AbstractDao {
if (column != -1) { if (column != -1) {
dto.favoriteRegisterDate = cursor.getString(column); dto.favoriteRegisterDate = cursor.getString(column);
} }
column = cursor.getColumnIndex("self_flg");
if (column != -1) {
dto.selfFlg = cursor.getInt(column);
}
return dto; return dto;
} }
...@@ -52,8 +57,83 @@ public class ShopMemberDao extends AbstractDao { ...@@ -52,8 +57,83 @@ public class ShopMemberDao extends AbstractDao {
public ShopMemberDto getShopMember(int shopMemberId) { public ShopMemberDto getShopMember(int shopMemberId) {
return rawQueryGetDto("select * from m_shop_member where shop_member_id=?", new String[]{""+ shopMemberId}, ShopMemberDto.class); return rawQueryGetDto("select * from m_shop_member where shop_member_id=?", new String[]{""+ shopMemberId}, ShopMemberDto.class);
} }
public void insertShopMember(ShopMemberDto dto) { public void insertShopMember(ShopMemberDto dto) {
insert("insert into m_shop_member (shop_member_id, shop_member_name, profile_url, favorite_register_date) values (?,?,?,?)", dto.getInsertValues()); try {
beginTransaction();
insert("insert or replace into m_shop_member (shop_member_id, shop_member_name, profile_url, favorite_register_date, self_flg) values (?,?,?,?,?)", dto.getInsertValues());
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) {
rollback();
Logger.e("insertShopMember failed.", e);
throw new RuntimeException(e);
} finally {
}
}
public void insertShopMember(List<ShopMemberDto> dtoList) {
try {
beginTransaction();
for (ShopMemberDto dto : dtoList) {
insert("insert or replace into m_shop_member (shop_member_id, shop_member_name, profile_url, favorite_register_date, self_flg) values (?,?,?,?,?)", dto.getInsertValues());
if (dto.groupIdList == null) { continue; }
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) {
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);
}
public List<ShopMemberDto> getfavoriteUserList() {
return rawQueryGetDtoList("select * from m_shop_member where favorite_register_date NOT NULL", null, ShopMemberDto.class);
}
public List<ShopMemberDto> getUserListByGroupId(Integer groupId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" sm.shop_member_id ");
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url");
sql.append(" FROM ");
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE rsmg.group_id =?");
sql.append(" AND sm.self_flg != 1");
sql.append(" ORDER BY sm.shop_member_name DESC ");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), new String[]{""+ groupId}, ShopMemberDto.class);
return list;
}
public List<ShopMemberDto> getMyGroupUsers() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" sm.shop_member_id ");
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url");
sql.append(" FROM ");
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
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 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(" ORDER BY sm.shop_member_name DESC ");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), null, ShopMemberDto.class);
return list;
} }
public boolean updateShopMember(MemberInfoDto dto) { public boolean updateShopMember(MemberInfoDto dto) {
......
...@@ -34,6 +34,7 @@ public class MGroup extends SQLiteTableScript { ...@@ -34,6 +34,7 @@ public class MGroup extends SQLiteTableScript {
sql.append(" , group_name VARCHAR(64) NOT NULL "); sql.append(" , group_name VARCHAR(64) NOT NULL ");
sql.append(" , group_path TEXT NOT NULL "); // path enumaerationパターンを適用する。since DatabaseVersions.Ver1_5_0 sql.append(" , group_path TEXT NOT NULL "); // path enumaerationパターンを適用する。since DatabaseVersions.Ver1_5_0
sql.append(" , user_group_flg BOOLEAN NOT NULL DEFAULT 0 "); // since DatabaseVersions.Plus_1_1_0 sql.append(" , user_group_flg BOOLEAN NOT NULL DEFAULT 0 "); // since DatabaseVersions.Plus_1_1_0
sql.append(" , favorite_register_date VARCHAR2(64) ");
sql.append(" , PRIMARY KEY (group_relation_id) "); sql.append(" , PRIMARY KEY (group_relation_id) ");
sql.append(" ) "); sql.append(" ) ");
......
...@@ -20,6 +20,7 @@ public class MShopMember extends SQLiteTableScript { ...@@ -20,6 +20,7 @@ public class MShopMember extends SQLiteTableScript {
sql.append(" , shop_member_name VARCHAR(64) "); sql.append(" , shop_member_name VARCHAR(64) ");
sql.append(" , profile_url VARCHAR(64) "); sql.append(" , profile_url VARCHAR(64) ");
sql.append(" , favorite_register_date VARCHAR2(64) "); sql.append(" , favorite_register_date VARCHAR2(64) ");
sql.append(" , self_flg INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (shop_member_id) "); sql.append(" , PRIMARY KEY (shop_member_id) ");
sql.append(" ) "); sql.append(" ) ");
......
...@@ -2,28 +2,22 @@ package jp.agentec.abook.abv.bl.data.tables; ...@@ -2,28 +2,22 @@ package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class RChatRoomShopMember extends SQLiteTableScript { public class RChatRoomShopMember extends SQLiteTableScript {
public RChatRoomShopMember() { public RChatRoomShopMember() {
super();
} }
@Override @Override
public List<String> getCreateScript(int version) { public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>(); List<String> ddl = new ArrayList();
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" create table r_chat_room_shop_member ( "); sql.append(" create table r_chat_room_shop_member ( ");
sql.append(" chat_room_id INTEGER NOT NULL "); sql.append(" chat_room_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL "); sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (chat_room_id, shop_member_id) "); sql.append(" , PRIMARY KEY (chat_room_id, shop_member_id) ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
return ddl; return ddl;
} }
...@@ -36,5 +30,4 @@ public class RChatRoomShopMember extends SQLiteTableScript { ...@@ -36,5 +30,4 @@ public class RChatRoomShopMember extends SQLiteTableScript {
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) { public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null; return null;
} }
}
} \ No newline at end of file
...@@ -12,6 +12,9 @@ public class ChatMessageDto extends AbstractDto { ...@@ -12,6 +12,9 @@ public class ChatMessageDto extends AbstractDto {
public String downloadFileName; public String downloadFileName;
public String savePath; public String savePath;
public String insertDate; public String insertDate;
public String shopMemberName;
public String profileUrl;
public Integer selfFlg;
@Override @Override
public Object[] getInsertValues() { public Object[] getInsertValues() {
......
...@@ -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;
......
package jp.agentec.abook.abv.bl.dto; package jp.agentec.abook.abv.bl.dto;
import java.util.List;
/** /**
* グループ情報を格納します。m_groupのPKであるgroup_relation_idはこのdtoの扱いません。内部的なキーはgetKyeValuesメソッドで定義してあります。 * グループ情報を格納します。m_groupのPKであるgroup_relation_idはこのdtoの扱いません。内部的なキーはgetKyeValuesメソッドで定義してあります。
* @author Taejin Hong * @author Taejin Hong
...@@ -15,8 +17,12 @@ public class GroupDto extends AbstractDto { ...@@ -15,8 +17,12 @@ public class GroupDto extends AbstractDto {
public int contentCount = 0; public int contentCount = 0;
public String displayCount; public String displayCount;
public String groupPath; public String groupPath;
public String favoriteRegisterDate = "";
public boolean userGroupFlg; public boolean userGroupFlg;
public int delFlg;
public List<ShopMemberDto> groupMembers;
public List<String> groupPathList;
public GroupDto() { public GroupDto() {
} }
......
package jp.agentec.abook.abv.bl.dto; package jp.agentec.abook.abv.bl.dto;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
public class ShopMemberDto extends AbstractDto { public class ShopMemberDto extends AbstractDto {
...@@ -7,10 +8,12 @@ public class ShopMemberDto extends AbstractDto { ...@@ -7,10 +8,12 @@ public class ShopMemberDto extends AbstractDto {
public String shopMemberName; public String shopMemberName;
public String profileUrl; public String profileUrl;
public String favoriteRegisterDate; public String favoriteRegisterDate;
public Integer selfFlg;
public ArrayList<Integer> groupIdList;
@Override @Override
public Object[] getInsertValues() { public Object[] getInsertValues() {
return new Object[] { shopMemberId, shopMemberName, profileUrl, favoriteRegisterDate }; return new Object[] { shopMemberId, shopMemberName, profileUrl, favoriteRegisterDate, selfFlg };
} }
@Override @Override
...@@ -23,4 +26,8 @@ public class ShopMemberDto extends AbstractDto { ...@@ -23,4 +26,8 @@ public class ShopMemberDto extends AbstractDto {
return new String[]{ "" + shopMemberId }; return new String[]{ "" + shopMemberId };
} }
public Object[] getGroupIds() {
return groupIdList.toArray();
}
} }
...@@ -68,7 +68,12 @@ public abstract class HttpParameterObject extends ADFObject { ...@@ -68,7 +68,12 @@ public abstract class HttpParameterObject extends ADFObject {
Object value = method.invoke(this); Object value = method.invoke(this);
if (value != null) { if (value != null) {
sb.append(URLEncoder.encode(value.toString(), encoding).replace("+", "%20")); if (propertyName.equals("groupIds")) {
sb.append(value);
} else {
sb.append(URLEncoder.encode(value.toString(), encoding).replace("+", "%20"));
}
} }
sb.append(DelimiterKeyKey); sb.append(DelimiterKeyKey);
......
...@@ -28,32 +28,29 @@ import android.widget.ImageView; ...@@ -28,32 +28,29 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import org.json.JSONArray;
import java.io.File; import java.io.File;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient; import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsCommonJSON; import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON;
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.RoomListJSON; import jp.agentec.abook.abv.bl.acms.client.json.RoomListJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.common.ABVEnvironment; import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
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;
import jp.agentec.abook.abv.bl.data.ABVDataCache; import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto; import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ContentReadingLogDto; import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto; import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.CommunicationLogic; import jp.agentec.abook.abv.bl.logic.CommunicationLogic;
import jp.agentec.abook.abv.bl.logic.ContentLogic;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType; import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
...@@ -65,7 +62,6 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil; ...@@ -65,7 +62,6 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity; import jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity;
import jp.agentec.adf.net.http.HttpResponse;
import static org.chromium.net.NetError.ERR_FAILED; import static org.chromium.net.NetError.ERR_FAILED;
...@@ -83,12 +79,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -83,12 +79,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
//private final String NETWORK_ERROR_PLACE_HOLDER = "file:///android_asset/chat/public/networkError.html"; //private final String NETWORK_ERROR_PLACE_HOLDER = "file:///android_asset/chat/public/networkError.html";
private final String CHAT_PAGE_URL = "file:///android_asset/chat/public/index.html"; private final String CHAT_PAGE_URL = "file:///android_asset/chat/public/index.html";
private final String DEFAULT_CHECKSUM = "0000000000";
//AISDevelop //AISDevelop
private JsInf jsInf = new JsInf(); private JsInf jsInf = new JsInf();
private ValueCallback<Uri[]> mUploadMessage; private ValueCallback<Uri[]> mUploadMessage;
private String sid, roomName, loginId, shopName; private String sid;
private String roomName;
private String loginId;
private String shopName;
private boolean isOnline; private boolean isOnline;
private Long roomId; private Long roomId;
...@@ -124,6 +124,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -124,6 +124,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
if (AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).checkSid(sid)) { if (AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).checkSid(sid)) {
isOnline = true; isOnline = true;
chatWebviewUrl = CHAT_PAGE_URL; chatWebviewUrl = CHAT_PAGE_URL;
updateMyInfoFromServer();
} }
} catch (Exception e) { } catch (Exception e) {
Logger.d("SID_CHECK_ERROR"); Logger.d("SID_CHECK_ERROR");
...@@ -685,9 +686,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -685,9 +686,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
@JavascriptInterface @JavascriptInterface
public String getRoomList() { public String getRoomList(String roomType) {
Map<String, Object> chatRoomList;
String chatRoomListStr = communicationLogic.getChatRoomList(); String chatRoomListStr = communicationLogic.getChatRoomList(Integer.parseInt(roomType));
return chatRoomListStr; return chatRoomListStr;
} }
...@@ -698,6 +699,88 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -698,6 +699,88 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
communicationLogic.deleteChatRoomList(); communicationLogic.deleteChatRoomList();
communicationLogic.insertChatRoomList(resultJson.roomList); communicationLogic.insertChatRoomList(resultJson.roomList);
} }
@JavascriptInterface
public void updateMyInfo() throws NetworkDisconnectedException, AcmsException {
updateMyInfoFromServer();
}
@JavascriptInterface
public void updateGroupInfo(String groupId) throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer(groupId);
}
@JavascriptInterface
public void updateGroupUser() throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer(communicationLogic.getMyGroupIds());
}
@JavascriptInterface
public void createChatRoom(String roomType, String userIdList, String encodedRoomName) throws NetworkDisconnectedException, AcmsException {
CreatedRoomJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).createRoom(sid, roomType, userIdList, encodedRoomName);
communicationLogic.insertChatRoom(resultJson.chatRoomDto);
final Integer chatRoomId = resultJson.chatRoomDto.chatRoomId;
final String chatRoomName = resultJson.chatRoomDto.chatRoomName;
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl(String.format("javascript:CHAT_UI.joinRoom('%s', '%s');", chatRoomId, chatRoomName));
}
});
}
@JavascriptInterface
public void updateMessages(String roomId) throws NetworkDisconnectedException, AcmsException {
MessageInfoListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMessages(sid, roomId);
for (ChatMessageDto chatMessageDto : resultJson.chatMessageDtoArrayList) {
chatMessageDto.chatRoomId = Integer.parseInt(roomId);
}
communicationLogic.insertMessageList(resultJson.chatMessageDtoArrayList);
communicationLogic.insertShopMember(resultJson.shopMemberDtoArrayList);
}
@JavascriptInterface
public String getMessageList(String roomId) {
String messageListStr = communicationLogic.getMessages(Integer.parseInt(roomId));
return messageListStr;
}
@JavascriptInterface
public String getFavoriteUsers() {
String favoriteUsersStr = communicationLogic.getFavoriteUsers();
return favoriteUsersStr;
}
@JavascriptInterface
public String getMyInfo() {
String myInfoStr = communicationLogic.getMyInfo();
return myInfoStr;
}
@JavascriptInterface
public String getMyGroupUsers() {
String myGroupUsersStr = communicationLogic.getMyGroupUsers();
return myGroupUsersStr;
}
@JavascriptInterface
public String getFavoriteGroups() {
String favoriteGroupsStr = communicationLogic.getFavoriteGroups();
return favoriteGroupsStr;
}
@JavascriptInterface
public void updateUserInfo(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
updateUserInfoFromServer(shopMemberId);
}
@JavascriptInterface
public String getGroupInfo(String groupId) throws NetworkDisconnectedException, AcmsException {
String groupInfoStr = communicationLogic.getGroupSearchData(Integer.parseInt(groupId));
return groupInfoStr;
}
} }
/** /**
...@@ -712,6 +795,20 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -712,6 +795,20 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
startActivity(intent, NaviConsts.Left); startActivity(intent, NaviConsts.Left);
} }
private void updateMyInfoFromServer() throws NetworkDisconnectedException, AcmsException {
MyInfoJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMyInfo(sid);
communicationLogic.insertMyInfo(resultJson.shopMemberDto);
}
private void updateUserInfoFromServer(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
MyInfoJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getNameCard(sid,shopMemberId);
communicationLogic.insertShopMember(resultJson.shopMemberDto);
}
private void updateGroupInfoFromServer(String groupIds) throws NetworkDisconnectedException, AcmsException {
GroupListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getGroupInfo(sid,groupIds,DEFAULT_CHECKSUM);
communicationLogic.updateGroup(resultJson.groupList);
}
/**  /** 
* ボタンイベント設定 * ボタンイベント設定
*/ */
...@@ -731,7 +828,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -731,7 +828,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
intent.setClass(ChatWebviewActivity.this, OperationRelatedContentActivity.class); intent.setClass(ChatWebviewActivity.this, OperationRelatedContentActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent, NaviConsts.Left); startActivity(intent, NaviConsts.Left);
// overridePendingTransition(R.anim.viewin_left_to_right, R.anim.viewin_left_to_right); // overridePendingTransition(R.anim.viewin_left_to_right, R.anim.viewin_left_to_right);
} }
// 設定画面へ遷移 // 設定画面へ遷移
......
...@@ -40,12 +40,12 @@ app_versioncode=1 ...@@ -40,12 +40,12 @@ app_versioncode=1
#cms server #cms server
#acms_address=http://10.0.2.2:8081/acms #acms_address=http://10.0.2.2:8081/acms
#download_server_address=http://10.0.2.2:8081/acms #download_server_address=http://10.0.2.2:8081/acms
acms_address=https://chatdev2.abook.bz/acms acms_address=https://chatdev2.agentec.jp/acms
download_server_address=https://chatdev2.abook.bz/acms download_server_address=https://chatdev2.agentec.jp/acms
#syncview server #syncview server
websocket_server_http_url=https://chatdev2.abook.bz/v1 websocket_server_http_url=https://chatdev2.agentec.jp/v1
websocket_server_ws_url=wss://chatdev2.abook.bz/v1 websocket_server_ws_url=wss://chatdev2.agentec.jp/v1
#WebSocket debug出力 #WebSocket debug出力
websocket_debug=false websocket_debug=false
......
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