Commit e8258333 by Lee Munkyeong

Merge branch 'features/abcomm_sp5_chat_UI' into 'features/abcomm_sp5'

Features/abcomm sp5 chat ui

See merge request !95
parents 8d3bc5b8 d1d19fdf
......@@ -18,6 +18,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.ApertureMasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.AppLatestVersionJSON;
import jp.agentec.abook.abv.bl.acms.client.json.AuthLevelJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CategoriesJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ChangeRoomNameJSON;
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.ContentVersionsJSON;
......@@ -47,6 +48,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AddMemberGroupParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AppStoreNewLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ChangeRoomNameParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.CheckSendLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ContentReadingLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.DeleteProcessParameters;
......@@ -64,6 +66,7 @@ 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.GetTaskFileParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.InviteUsersParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.PasswordChangeParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.PostEnqueteReplyParameters;
......@@ -615,6 +618,22 @@ public class AcmsClient implements AcmsClientResponseListener {
}
/**
* ルーム名更新。
*
* @param sid
* @param newRoomName
* @param roomId
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ChangeRoomNameJSON changeRoomName(String sid, String newRoomName, Integer roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetChatRooms, new ChangeRoomNameParameters(sid, AcmsApis.RoomCmds.changeRoomName, newRoomName, roomId));
ChangeRoomNameJSON json = new ChangeRoomNameJSON(response.httpResponseBody);
return json;
}
/**
* ルーム作成。
*
* @param sid
......@@ -630,6 +649,22 @@ public class AcmsClient implements AcmsClientResponseListener {
}
/**
* ユーザ招待。
*
* @param sid
* @param roomId
* @param roomName
* @param userIds
* @return 成功有無
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public boolean inviteUsers(String sid, Integer roomId, String roomName, String userIds) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetUser, new InviteUsersParameters(sid, AcmsApis.UserCmds.inviteUsers, roomId, roomName, userIds));
return response.httpResponseCode == 200;
}
/**
* お気に入りユーザ追加。。
*
* @param sid
......
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 ChangeRoomNameJSON extends AcmsCommonJSON {
public Integer status;
public ChangeRoomNameJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
if (!json.has(ABookCommConstants.KEY.HTTP_STATUS)) { return; }
status = json.getInt(ABookCommConstants.KEY.HTTP_STATUS);
}
}
......@@ -60,6 +60,7 @@ public class GroupListJSON extends AcmsCommonJSON {
ShopMemberDto shopMemberDto = new ShopMemberDto();
shopMemberDto.shopMemberId = groupMember.getInt(ABookCommConstants.KEY.SHOP_MEMBER_ID);
shopMemberDto.shopMemberName = groupMember.getString(ABookCommConstants.KEY.MEMBER_NAME);
shopMemberDto.delFlg = groupMember.getInt(ABookCommConstants.KEY.DEL_FLG);
if (groupMember.has(ABookCommConstants.KEY.PROFILE_IMAGE_PATH)) {
shopMemberDto.profileUrl = groupMember.getString(ABookCommConstants.KEY.PROFILE_IMAGE_PATH);
}
......
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link ChangeRoomNameParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author lee-mk
* @version 1.0.0
*/
public class ChangeRoomNameParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private String newRoomName;
private Integer roomId;
/**
* {@link ChangeRoomNameParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param newRoomName ルーム名。
* @param roomId ルームID。
* @since 1.0.0
*/
public ChangeRoomNameParameters(String sid, String cmd, String newRoomName, Integer roomId) {
this.sid = sid;
this.cmd = cmd;
this.newRoomName = newRoomName;
this.roomId = roomId;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* アクションコマンドを返します。
* @return APIのアクションコマンドです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
/**
* ルーム名を返します。
* @return ルーム名です。
* @since 1.0.0
*/
public String getNewRoomName() {
return newRoomName;
}
/**
* ルームIDを返します。
* @return 変更対象のルームIDです。
* @since 1.0.0
*/
public Integer getRoomId() {
return roomId;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* @author Lee-mk
* @version 1.0.0
*/
public class InviteUsersParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private Integer newRoomId;
private String newRoomName;
private String loginIdList;
/**
* {@link InviteUsersParameters} のインスタンスを初期化します。
* @param sid
* @param cmd
* @param roomId
* @param newRoomName
* @param loginIdList
* @since 1.0.0
*/
public InviteUsersParameters(String sid, String cmd, Integer newRoomId, String newRoomName, String loginIdList) {
this.sid = sid;
this.cmd = cmd;
this.newRoomId = newRoomId;
this.newRoomName = newRoomName;
this.loginIdList = loginIdList;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return コマンド。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
/**
* roomIdを返します。
* @return roomId。
* @since 1.0.0
*/
public Integer getNewRoomId() {
return newRoomId;
}
/**
* newRoomNameを返します。
* @return newRoomName。
* @since 1.0.0
*/
public String getNewRoomName() {
return newRoomName;
}
/**
* loginIdListを返します。
* @return loginIdList。
* @since 1.0.0
*/
public String getLoginIdList() {
return loginIdList;
}
}
......@@ -176,6 +176,7 @@ public class AcmsApis {
public static final String ApigetFavorite = "favorite";
public static final class UserCmds {
public static final String inviteUsers = "3";
public static final String getMyInfo = "9";
public static final String getGroupInfo = "10";
public static final String getNameCard = "11";
......@@ -184,6 +185,7 @@ public class AcmsApis {
public static final class RoomCmds {
public static final String getRoomList = "5";
public static final String createRoom = "2";
public static final String changeRoomName = "6";
}
public static final class MessageCmds {
......
......@@ -27,12 +27,14 @@ public interface ABookCommConstants {
String PROFILE_URL = "profileUrl";
String GROUP_NAME = "groupName";
String GROUP_ID = "groupId";
String GROUP_PATH = "groupPath";
String GROUP_IDS = "groupIds";
String GROUP_PATH_LIST = "groupPathList";
String IS_FAVORITE = "isFavorite";
String CHILD_GROUP_LIST = "childGroupList";
String GROUP_USER_LIST = "groupUserList";
String BODY = "body";
String CHECKED = "checked";
String CHAT_ROOM_INFO = "chatRoomInfo";
String ROOM_ID = "roomId";
......@@ -57,7 +59,7 @@ public interface ABookCommConstants {
String ROOT_GROUP_ID = "rootGroupId";
String HTTP_STATUS = "httpStatus";
interface API_KIND {
String USER = "user";
String ROOM = "room";
......@@ -73,7 +75,14 @@ public interface ABookCommConstants {
Integer OFF = 0;
Integer ON = 1;
}
interface DEL_FLAG {
Integer EXIST = 0;
Integer DELETE = 1;
}
Integer GROUP_REQUEST_ALL = 0;
}
interface SIZE {
Integer MAX_FAVORITE_COUNT = 100;
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.List;
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;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.adf.util.StringUtil;
public class ChatMessageDao extends AbstractDao {
......@@ -99,6 +101,44 @@ public class ChatMessageDao extends AbstractDao {
return list;
}
public List<ChatMessageDto> searchChatMessage(int chatRoomId, String[] keywords, String userList) {
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.message_type = 0 ");
List<String> whereSqlList = new ArrayList<String>();
for (String keyword : keywords) {
whereSqlList.add("cm.message LIKE '%" + keyword + "%'");
}
String whereSql = StringUtil.join(" OR ", whereSqlList);
if (!StringUtil.isNullOrEmpty(whereSql)) {
sql.append("AND (" + whereSql + ")");
}
if (!StringUtil.isNullOrEmpty(userList)) {
sql.append(" AND cm.shop_member_id IN (" + userList + ") ");
}
sql.append("AND 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;
}
public void insertChatMessage(ChatMessageDto dto) {
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());
}
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
......@@ -7,6 +8,7 @@ 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.ShopMemberDto;
import jp.agentec.adf.util.StringUtil;
public class ChatRoomDao extends AbstractDao {
......@@ -43,6 +45,10 @@ public class ChatRoomDao extends AbstractDao {
if (column != -1) {
dto.userCount = cursor.getInt(column);
}
column = cursor.getColumnIndex("view_flg");
if (column != -1) {
dto.viewFlg = cursor.getInt(column);
}
column = cursor.getColumnIndex("favorite_register_date");
if (column != -1) {
dto.favoriteRegisterDate = cursor.getString(column);
......@@ -80,12 +86,62 @@ public class ChatRoomDao extends AbstractDao {
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(" WHERE cr.type =? ");
sql.append(" AND (cr.view_flg IS null OR cr.view_flg != 1 )");
sql.append(" GROUP BY cr.chat_room_id ");
sql.append(" ORDER BY CASE WHEN unread_count = 0 THEN 0 ELSE 1 END DESC, cm.insert_date DESC ");
List<ChatRoomDto> list = rawQueryGetDtoList(sql.toString(), new String[]{""+ roomType}, ChatRoomDto.class);
return list;
}
public ChatRoomDto getChatRoom(Integer roomId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" cr.chat_room_id ");
sql.append(" ,cr.chat_room_name ");
sql.append(" ,cr.type ");
sql.append(" FROM ");
sql.append(" t_chat_room AS cr ");
sql.append(" WHERE cr.chat_room_id =? ");
ChatRoomDto list = rawQueryGetDto(sql.toString(), new String[]{""+ roomId}, ChatRoomDto.class);
return list;
}
public List<ChatRoomDto> getAllChatRoombyKeyword(String[] keywords) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" cr.chat_room_id ");
sql.append(" ,cr.chat_room_name ");
sql.append(" ,cr.type ");
sql.append(" ,coalesce (cr.favorite_register_date,'') favorite_register_date");
sql.append(" ,coalesce (cr.unread_count,0) unread_count");
sql.append(" ,coalesce (cm.message,'') message");
sql.append(" ,coalesce (cm.message_type,0) message_type");
sql.append(" ,coalesce (cm.insert_date,'') insert_date");
sql.append(" ,coalesce (cr.user_count,0) user_count ");
sql.append(" FROM ");
sql.append(" t_chat_room AS cr ");
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(" ON cr.chat_room_id = cm.chat_room_id ");
sql.append(" LEFT JOIN r_chat_room_shop_member rcrsm ");
sql.append(" ON cr.chat_room_id = rcrsm.chat_room_id ");
sql.append(" INNER JOIN m_shop_member sm ");
sql.append(" ON rcrsm.shop_member_id = sm.shop_member_id ");
sql.append(" WHERE ");
List<String> whereSqlList = new ArrayList<String>();
for (String keyword : keywords) {
whereSqlList.add("cr.chat_room_name LIKE '%" + keyword + "%'");
whereSqlList.add("sm.shop_member_name LIKE '%" + keyword + "%'");
}
String whereSql = StringUtil.join(" OR ", whereSqlList);
sql.append(whereSql);
sql.append(" AND (cr.view_flg IS null OR cr.view_flg != 1 )");
sql.append(" GROUP BY cr.chat_room_id ");
sql.append(" ORDER BY CASE WHEN unread_count = 0 THEN 0 ELSE 1 END DESC, cm.insert_date DESC ");
List<ChatRoomDto> list = rawQueryGetDtoList(sql.toString(), null, ChatRoomDto.class);
return list;
}
public ChatRoomDto getFavoriteChatRoom() {
return rawQueryGetDto("select * from t_chat_room where favorite_register_date is NOT NULL", null, ChatRoomDto.class);
}
......@@ -95,7 +151,20 @@ public class ChatRoomDao extends AbstractDao {
}
public void insertChatRoom(ChatRoomDto dto) {
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());
Integer chatRoomId = dto.chatRoomId;
if (dto.unreadCount == 0) {
insert("insert or replace into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date, view_flg) values (?,?,?,?,?,?, (select view_flg from t_chat_room where chat_room_id =" + chatRoomId + "))", dto.getInsertValues());
} else {
insert("insert or replace into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date, view_flg) values (?,?,?,?,?,?,0)", dto.getInsertValues());
}
}
public void updateChatRoomName(String roomName, Integer roomId) {
update("update t_chat_room set chat_room_name = ? where chat_room_id = ?", new Object[]{roomName, roomId});
}
public void changeRoomViewFlg(Integer roomId) {
update("update t_chat_room set view_flg = 1 where chat_room_id = ?", new String[]{"" + roomId});
}
public void insertChatRoom(List<ChatRoomDto> chatRoomDtoList) {
......@@ -127,8 +196,8 @@ public class ChatRoomDao extends AbstractDao {
public void deleteChatRoom() {
try {
beginTransaction();
delete("t_chat_room", null, null);
delete("r_chat_room_shop_member", null, null);
delete("t_chat_room", null, null);
commit();
} catch (Exception e) {
rollback();
......
......@@ -90,13 +90,13 @@ public class GroupDao extends AbstractDao {
return rawQueryGetStringList(sql.toString(), null);
}
public List<String> getUserGroupPathList(Integer shopMemberId) {
public List<GroupDto> getUserGroupPathList(Integer shopMemberId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" CASE WHEN (grandparentgroup.group_name IS NOT NULL) THEN grandparentgroup.group_name || ' / ' || parentgroup.group_name || ' / ' || usergroup.group_name ");
sql.append(" WHEN (parentgroup.group_name IS NOT NULL) THEN parentgroup.group_name || ' / ' || usergroup.group_name ");
sql.append(" ELSE usergroup.group_name ");
sql.append(" END AS group_path_list ");
sql.append(" END AS group_path, usergroup.group_id ");
sql.append(" FROM m_group usergroup ");
sql.append(" LEFT JOIN m_group parentgroup on usergroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
......@@ -104,7 +104,7 @@ public class GroupDao extends AbstractDao {
sql.append(" (SELECT group_id ");
sql.append(" FROM m_shop_member sm INNER JOIN r_shop_member_group rsmg on sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE sm.shop_member_id = ? ) ");
return rawQueryGetStringList(sql.toString(), new String[] { "" + shopMemberId});
return rawQueryGetDtoList(sql.toString(), new String[] { "" + shopMemberId}, GroupDto.class);
}
private String generateGetGroupsQuery(QueryType queryType, int[] groupRelationids, int[] parentGroupIds, Boolean downloaded, String searchKeyword, SearchDivisionType searchDivisionType, boolean isOnlineSearched) {
......@@ -546,7 +546,7 @@ public class GroupDao extends AbstractDao {
public List<GroupDto> getGroupChildList(int parentId) {
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 = ?) ORDER BY group_name", new String[]{""+ parentId}, GroupDto.class);
return list;
}
......@@ -563,7 +563,7 @@ public class GroupDao extends AbstractDao {
}
public List<GroupDto> getUserGroups() {
return rawQueryGetDtoList("select * from m_group where user_group_flg = 1", null, GroupDto.class);
return rawQueryGetDtoList("select * from m_group where user_group_flg = 1 ORDER BY group_name", null, GroupDto.class);
}
/**
......
......@@ -113,10 +113,34 @@ public class ShopMemberDao extends AbstractDao {
return list;
}
public List<ShopMemberDto> getSelectedUsers(String userIdList) {
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(" WHERE sm.shop_member_id IN ( "+userIdList+" )");
sql.append(" AND sm.self_flg != 1");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), new String[]{}, ShopMemberDto.class);
return list;
}
public List<ShopMemberDto> getfavoriteUserList() {
return rawQueryGetDtoList("select * from m_shop_member where favorite_register_date NOT NULL", null, ShopMemberDto.class);
}
public List<ShopMemberDto> getfavoriteUserListNotInRoom(Integer roomId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT * ");
sql.append(" FROM m_shop_member sm ");
sql.append(" WHERE favorite_register_date NOT NULL ");
sql.append(" AND sm.shop_member_id NOT IN");
sql.append(" (SELECT shop_member_id FROM r_chat_room_shop_member WHERE chat_room_id = ?)");
return rawQueryGetDtoList(sql.toString(), new String[] {"" + roomId}, ShopMemberDto.class);
}
public List<ShopMemberDto> getUserListByGroupId(Integer groupId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
......@@ -135,7 +159,7 @@ public class ShopMemberDao extends AbstractDao {
return list;
}
public List<ShopMemberDto> getUserInMyGroupByName(String shopMemberName) {
public List<ShopMemberDto> getUserListNotInRoomByGroupId(Integer groupId, Integer roomId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" sm.shop_member_id ");
......@@ -146,6 +170,25 @@ public class ShopMemberDao extends AbstractDao {
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(" AND sm.shop_member_id NOT IN (SELECT shop_member_id FROM r_chat_room_shop_member WHERE chat_room_id = ?)");
sql.append(" ORDER BY sm.shop_member_name DESC ");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), new String[]{"" + groupId, "" + roomId}, ShopMemberDto.class);
return list;
}
public List<ShopMemberDto> getUserInMyGroupByName(String shopMemberName) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT DISTINCT");
sql.append(" sm.shop_member_id ");
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url");
sql.append(" ,sm.favorite_register_date");
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_group WHERE user_group_flg = 1)");
sql.append(" AND sm.self_flg != 1");
sql.append(" AND sm.shop_member_name LIKE '%"+shopMemberName+"%' ");
......@@ -154,9 +197,29 @@ public class ShopMemberDao extends AbstractDao {
return list;
}
public List<ShopMemberDto> getUserInMyGroupNotInRoomByName(String shopMemberName, Integer roomId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT DISTINCT");
sql.append(" sm.shop_member_id ");
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url");
sql.append(" ,sm.favorite_register_date");
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_group WHERE user_group_flg = 1)");
sql.append(" AND sm.self_flg != 1");
sql.append(" AND sm.shop_member_id NOT IN (SELECT shop_member_id FROM r_chat_room_shop_member WHERE chat_room_id = ?)");
sql.append(" AND sm.shop_member_name LIKE '%"+shopMemberName+"%' ");
sql.append(" ORDER BY sm.shop_member_name DESC ");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), new String[]{"" + roomId}, ShopMemberDto.class);
return list;
}
public List<ShopMemberDto> getUserInAllGroupByName(String shopMemberName) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" SELECT DISTINCT");
sql.append(" sm.shop_member_id ");
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url");
......@@ -172,6 +235,25 @@ public class ShopMemberDao extends AbstractDao {
return list;
}
public List<ShopMemberDto> getUserInAllGroupNotInRoomByName(String shopMemberName, Integer roomId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT DISTINCT");
sql.append(" sm.shop_member_id ");
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url");
sql.append(" ,sm.favorite_register_date");
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(" AND sm.self_flg != 1");
sql.append(" AND sm.shop_member_name LIKE '%"+shopMemberName+"%' ");
sql.append(" AND sm.shop_member_id NOT IN (SELECT shop_member_id FROM r_chat_room_shop_member WHERE chat_room_id = ?) ");
sql.append(" ORDER BY sm.shop_member_name DESC ");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), new String[] {"" + roomId}, ShopMemberDto.class);
return list;
}
public List<ShopMemberDto> getMyGroupUsers() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
......@@ -194,6 +276,29 @@ public class ShopMemberDao extends AbstractDao {
return count > 0;
}
public boolean deleteShopMember(ShopMemberDto dto) {
long count = update("delete from m_shop_member where shop_member_id=?", new String[] {"" + dto.shopMemberId});
return count > 0;
}
public void deleteShopMemberByList(List<ShopMemberDto> dtoList) {
try {
beginTransaction();
for (ShopMemberDto dto : dtoList) {
update("delete from r_shop_member_group where shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("delete from r_chat_room_shop_member where shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("delete from m_shop_member where shop_member_id=?", new String[] {"" + dto.shopMemberId});
}
commit();
} catch (Exception e) {
rollback();
Logger.e("insertShopMember failed.", e);
throw new RuntimeException(e);
} finally {
}
}
public boolean updateFavoriteUser(ShopMemberDto dto) {
long count = update("update m_shop_member set favorite_register_date=? where shop_member_id=?", new Object[]{dto.favoriteRegisterDate, dto.shopMemberId});
return count > 0;
......@@ -202,6 +307,8 @@ public class ShopMemberDao extends AbstractDao {
public void deleteShopMember() {
try {
beginTransaction();
delete("r_collaboration_member", null, null);
delete("r_shop_member_group", null, null);
delete("m_shop_member", null, null);
commit();
} catch (Exception e) {
......
......@@ -21,6 +21,7 @@ public class TChatRoom extends SQLiteTableScript {
sql.append(" , type INTEGER NOT NULL ");
sql.append(" , unread_count INTEGER ");
sql.append(" , user_count INTEGER ");
sql.append(" , view_flg INTEGER ");
sql.append(" , favorite_register_date VARCHAR2(64) ");
sql.append(" , PRIMARY KEY (chat_room_id) ");
sql.append(" ) ");
......
......@@ -13,6 +13,7 @@ public class ChatRoomDto extends AbstractDto {
public Integer unreadCount = 0;
public Integer userCount;
public String message;
public Integer viewFlg;
public Integer messageType;
public String insertDate;
public ChatMessageDto lastMessageInfo;
......
......@@ -9,6 +9,7 @@ public class ShopMemberDto extends AbstractDto {
public String profileUrl;
public String favoriteRegisterDate;
public Integer selfFlg;
public Integer delFlg;
public ArrayList<Integer> groupIdList;
@Override
......
......@@ -17,6 +17,7 @@ import java.util.Map;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
......@@ -64,6 +65,10 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
String roomName = "";
String pushSendLoginId = "";
long pushSendDate = 0;
Integer insertId = 0;
Integer messageType = 0;
Integer messageId = 0;
Log.d(TAG,"tempMsg : "+ tempMsg);
if (tempMsg.indexOf("pushSendLoginId") > 0) {
......@@ -77,6 +82,12 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
pushSendDate = json.getLong("pushSendDate");
pushMsg = json.getString("message");
//TODO pushメッセージが到着した際、新着メッセージかルーム招待か判別してDB格納が必要
//insertId = json.getString("insertId");
//ChatMessageDto chatMessageDto = new ChatMessageDto();
//chatMessageDto.chatRoomId =
//chatRoomId shopMemberId messge messageType insertDate
if (pushMsg.length() > 0) {
tempMsg = pushMsg;
}
......
......@@ -10,6 +10,7 @@ import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.ExceptionDetailMessage;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
......@@ -24,6 +25,7 @@ import jp.agentec.abook.abv.bl.download.ContentRefresher;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.PasswordLockInfoDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.CommunicationLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
......@@ -41,6 +43,7 @@ import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.adf.util.StringUtil;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.view.Gravity;
......@@ -66,7 +69,7 @@ public class LoginActivity extends ABVLoginActivity {
private static final String TAG = "LoginActivity";
private UserAuthenticateLogic userAuthenticateLogic;
private CommunicationLogic communicationLogic;
private MemberInfoDao memberInfoDao;
private ContractLogic contractLogic;
......@@ -99,6 +102,7 @@ public class LoginActivity extends ABVLoginActivity {
contractLogic = AbstractLogic.getLogic(ContractLogic.class);
userAuthenticateLogic = AbstractLogic.getLogic(UserAuthenticateLogic.class);
communicationLogic = AbstractLogic.getLogic(CommunicationLogic.class);
memberInfoDao = AbstractDao.getDao(MemberInfoDao.class);
imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
......@@ -635,6 +639,7 @@ public class LoginActivity extends ABVLoginActivity {
// ユーザ変更があった場合、チャットのルーム情報をクリアする
clearChatLastRoom();
abookCommClear();
//ユーザ変更があった場合、FetchDateをクリアする
AcmsDao dao = AbstractDao.getDao(AcmsDao.class);
......@@ -715,4 +720,11 @@ public class LoginActivity extends ABVLoginActivity {
// 最後のチャットのルーム
PreferenceUtil.putUserPref(getApplicationContext(), UserPrefKey.CHAT_LAST_ROOMID, "");
}
// AbookComm関連のデータをクリア
private void abookCommClear() {
//CheckSumクリア
deleteSharedPreferences(ABookCommConstants.TAG);
communicationLogic.clearAllData();
}
}
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