Commit 8a0562fb by Lee Munkyeong

Merge branch 'features/#458_create_new_group_table_for_communication' into 'features/abcomm_sp6'

Features/#458 create new group table for communication

See merge request !99
parents b80e56dd 4e243b6a
...@@ -8,16 +8,13 @@ import java.util.ArrayList; ...@@ -8,16 +8,13 @@ import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants; 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.ChatGroupDto;
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.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeUtil;
public class GroupListJSON extends AcmsCommonJSON { public class GroupListJSON extends AcmsCommonJSON {
public ArrayList<GroupDto> groupList; public ArrayList<ChatGroupDto> groupList;
public String allGroupLastUpdateDate; public String allGroupLastUpdateDate;
public GroupListJSON(String jsonString) throws AcmsException { public GroupListJSON(String jsonString) throws AcmsException {
...@@ -34,14 +31,14 @@ public class GroupListJSON extends AcmsCommonJSON { ...@@ -34,14 +31,14 @@ public class GroupListJSON extends AcmsCommonJSON {
JSONArray groupListJsonArray = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONArray(ABookCommConstants.KEY.GROUP_INFO_LIST); JSONArray groupListJsonArray = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONArray(ABookCommConstants.KEY.GROUP_INFO_LIST);
if (groupListJsonArray == null) { return; } if (groupListJsonArray == null) { return; }
groupList = new ArrayList<GroupDto>(); groupList = new ArrayList<ChatGroupDto>();
for (int listCount = 0; listCount < groupListJsonArray.length(); listCount++) { for (int listCount = 0; listCount < groupListJsonArray.length(); listCount++) {
if (groupListJsonArray.getJSONObject(listCount).length() == 0) { if (groupListJsonArray.getJSONObject(listCount).length() == 0) {
break; break;
} }
JSONObject groupJSON = groupListJsonArray.getJSONObject(listCount); JSONObject groupJSON = groupListJsonArray.getJSONObject(listCount);
GroupDto groupDto = new GroupDto(); ChatGroupDto groupDto = new ChatGroupDto();
groupDto.groupId = groupJSON.getInt(ABookCommConstants.KEY.GROUP_ID); groupDto.groupId = groupJSON.getInt(ABookCommConstants.KEY.GROUP_ID);
if (groupJSON.has(ABookCommConstants.KEY.PARENT_GROUP_ID)) { if (groupJSON.has(ABookCommConstants.KEY.PARENT_GROUP_ID)) {
......
...@@ -11,6 +11,7 @@ import jp.agentec.abook.abv.bl.data.tables.LContentReadingLog; ...@@ -11,6 +11,7 @@ import jp.agentec.abook.abv.bl.data.tables.LContentReadingLog;
import jp.agentec.abook.abv.bl.data.tables.MAcms; import jp.agentec.abook.abv.bl.data.tables.MAcms;
import jp.agentec.abook.abv.bl.data.tables.MAppConfig; import jp.agentec.abook.abv.bl.data.tables.MAppConfig;
import jp.agentec.abook.abv.bl.data.tables.MCategory; import jp.agentec.abook.abv.bl.data.tables.MCategory;
import jp.agentec.abook.abv.bl.data.tables.MChatGroup;
import jp.agentec.abook.abv.bl.data.tables.MGroup; import jp.agentec.abook.abv.bl.data.tables.MGroup;
import jp.agentec.abook.abv.bl.data.tables.MMemberInfo; import jp.agentec.abook.abv.bl.data.tables.MMemberInfo;
import jp.agentec.abook.abv.bl.data.tables.MOperationGroupMaster; import jp.agentec.abook.abv.bl.data.tables.MOperationGroupMaster;
...@@ -111,6 +112,7 @@ public class ABVDataOpenHelper { ...@@ -111,6 +112,7 @@ public class ABVDataOpenHelper {
iTableScripts.add(new TTaskReportApproval()); iTableScripts.add(new TTaskReportApproval());
//ABCOMM関連テーブル //ABCOMM関連テーブル
iTableScripts.add(new MChatGroup());
iTableScripts.add(new MShopMember()); iTableScripts.add(new MShopMember());
iTableScripts.add(new TChatRoom()); iTableScripts.add(new TChatRoom());
iTableScripts.add(new TChatMessage()); iTableScripts.add(new TChatMessage());
......
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.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.StringUtil;
public class ChatGroupDao extends AbstractDao {
private static final String TAG = "ChatGroupDao";
/*package*/ ChatGroupDao() {
}
@Override
protected ChatGroupDto convert(Cursor cursor) {
ChatGroupDto dto = new ChatGroupDto();
int column = cursor.getColumnIndex("group_id");
if (column != -1) {
dto.groupId = cursor.getInt(column);
}
column = cursor.getColumnIndex("parent_group_id");
if (column != -1) {
dto.parentGroupId = cursor.getInt(column);
}
column = cursor.getColumnIndex("group_name");
if (column != -1) {
dto.groupName = cursor.getString(column);
}
column = cursor.getColumnIndex("favorite_register_date");
if (column != -1) {
dto.favoriteRegisterDate = cursor.getString(column);
}
return dto;
}
public List<ChatGroupDto> getAllGroups() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT group_id ");
sql.append(" ,parent_group_id ");
sql.append(" ,group_name ");
sql.append(" ,favorite_register_date ");
sql.append(" FROM m_chat_group");
return rawQueryGetDtoList(sql.toString(), null, ChatGroupDto.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_chat_group mygroup ");
sql.append(" LEFT JOIN m_chat_group parentgroup on mygroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE mygroup.group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1)");
return rawQueryGetStringList(sql.toString(), null);
}
public List<ChatGroupDto> 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, usergroup.group_id ");
sql.append(" FROM m_chat_group usergroup ");
sql.append(" LEFT JOIN m_chat_group parentgroup on usergroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE usergroup.group_id IN ");
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 rawQueryGetDtoList(sql.toString(), new String[] { "" + shopMemberId}, ChatGroupDto.class);
}
public void insertGroup(int groupId, int parentGroupId, String groupName) {
StringBuffer sql = new StringBuffer();
sql.append(" INSERT OR IGNORE INTO m_chat_group (group_id, parent_group_id, group_name) ");
sql.append(" VALUES (?,?,?) ");
try {
beginTransaction();
insert(sql.toString(), new Object[] { groupId, parentGroupId, groupName });
commit();
} catch (Exception e) {
rollback();
Logger.e("insertChatGroup failed.", e);
throw new RuntimeException(e);
}
Logger.v(TAG, "sql=%s", sql);
}
public void updateGroup(int groupId, int parentGroupId, String groupName) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_chat_group ");
sql.append(" SET group_name = ? ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
update(sql.toString(), new Object[] { groupName, groupId });
commit();
} catch (Exception e) {
rollback();
Logger.e("insertChatGroup failed.", e);
throw new RuntimeException(e);
}
Logger.v(TAG, "sql=%s", sql);
}
public void deleteGroup(ChatGroupDto dto, int defaultGroupId) {
String[] keyValues = dto.getKeyValues();
StringBuffer sql = new StringBuffer();
try{
beginTransaction();
delete("r_shop_member_group", "group_id=?", keyValues);
delete("m_chat_group", "group_id=?", keyValues);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteChatGroup failed.", e);
throw new RuntimeException(e);
} finally {
}
}
public void deleteChatGroup() {
try {
beginTransaction();
delete("r_shop_member_group", null, null);
delete("m_chat_group", null, null);
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteChatMessage failed.", e);
throw new RuntimeException(e);
} finally {
}
}
public ChatGroupDto getGroup(int groupId) {
return rawQueryGetDto("select * from m_chat_group where group_id = " + groupId, null, ChatGroupDto.class);
}
public List<ChatGroupDto> getFavoriteGroup() {
return rawQueryGetDtoList("select * from m_chat_group where favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, ChatGroupDto.class);
}
public List<ChatGroupDto> getGroupByName(String[] keywords) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT * ");
sql.append(" FROM m_chat_group ");
ArrayList<String> whereSqlList = new ArrayList<String>();
for (String keyword : keywords) {
if (StringUtil.isNullOrEmpty(keyword)) {
continue;
}
String whereSql = "group_name LIKE '%"+keyword+"%'";
whereSqlList.add(whereSql);
}
if (CollectionUtil.isNotEmpty(whereSqlList)) {
sql.append("WHERE " + StringUtil.join(" AND ", whereSqlList));
}
sql.append(" ORDER BY group_name ASC ");
return rawQueryGetDtoList(sql.toString(), null, ChatGroupDto.class);
}
public List<ChatGroupDto> getGroupTree(Integer groupId) {
List<ChatGroupDto> 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 from m_chat_group where group_id = ? ");
sql.append(" UNION ALL ");
sql.append(" SELECT rownum+1 rownum, parent.group_id, parent.group_name, parent.parent_group_id ");
sql.append(" FROM group_loop inner join m_chat_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}, ChatGroupDto.class);
return list;
}
public List<ChatGroupDto> getGroupChildList(int parentId) {
List<ChatGroupDto> list;
list = rawQueryGetDtoList("select * from m_chat_group mg where (mg.parent_group_id = ?) ORDER BY group_name", new String[]{""+ parentId}, ChatGroupDto.class);
return list;
}
public ChatGroupDto getRootGroup() {
return rawQueryGetDto("select * from m_chat_group mg where (mg.parent_group_id = 0)",null, ChatGroupDto.class);
}
public ChatGroupDto getParentGroup(Integer childGroupId) {
return rawQueryGetDto("select parent.* from m_chat_group parent inner join m_chat_group child on child.parent_group_id = parent.group_id where child.group_id = ?", new String[]{""+ childGroupId}, ChatGroupDto.class);
}
public boolean isExistParent(int baseId) {
return rawQueryGetInt("select * from m_chat_group where parent_group_id = " + baseId, null) > 0;
}
public List<ChatGroupDto> getMyGroups() {
return rawQueryGetDtoList("select * from m_chat_group where group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1) ORDER BY group_name ASC", null, ChatGroupDto.class);
}
public void insertGroupList(List<ChatGroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" INSERT INTO m_chat_group (group_id, parent_group_id, group_name) ");
sql.append(" VALUES (?,?,?) ");
try {
beginTransaction();
for (ChatGroupDto groupDto : groupList) {
insert(sql.toString(), new Object[] { groupDto.groupId, groupDto.parentGroupId, groupDto.groupName});
}
commit();
} catch (Exception e) {
rollback();
Logger.e("insertGroupList failed.", e);
throw new RuntimeException(e);
}
}
public void updateGroupList(List<ChatGroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_chat_group ");
sql.append(" SET group_name = ? ");
sql.append(" , parent_group_id = ? ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (ChatGroupDto 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<ChatGroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_chat_group ");
sql.append(" SET favorite_register_date = ? ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (ChatGroupDto 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<ChatGroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" delete from m_chat_group ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (ChatGroupDto groupDto : groupList) {
update(sql.toString(), new Object[] { groupDto.groupId });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteChatGroupList failed.", e);
throw new RuntimeException(e);
}
}
}
...@@ -347,7 +347,6 @@ public class ShopMemberDao extends AbstractDao { ...@@ -347,7 +347,6 @@ public class ShopMemberDao extends AbstractDao {
try { try {
beginTransaction(); beginTransaction();
delete("r_collaboration_member", null, null); delete("r_collaboration_member", null, null);
delete("r_shop_member_group", null, null);
delete("m_shop_member", null, null); delete("m_shop_member", null, null);
commit(); commit();
} catch (Exception e) { } catch (Exception e) {
......
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.adf.util.StringUtil;
/**
* AbookComm専用のグループマスターテーブルです。
* @author Lee mk
* @version 1.1.1
*/
public class MChatGroup extends SQLiteTableScript {
public MChatGroup() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
// since DatabaseVersions.Ver1_0_0
sql.append(" CREATE TABLE m_chat_group ( ");
sql.append(" group_id INTEGER NOT NULL ");
sql.append(" , parent_group_id INTEGER NOT NULL ");
sql.append(" , group_name VARCHAR(64) NOT NULL ");
sql.append(" , favorite_register_date VARCHAR2(64) ");
sql.append(" , PRIMARY KEY (group_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
StringUtil.clear(sql);
sql.append(" CREATE INDEX idx_chat_group_1 ON m_chat_group ( ");
sql.append(" parent_group_id ");
sql.append(" ) ");
ddl.add(sql.toString());
StringUtil.clear(sql);
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.List;
/**
* グループ情報を格納します。m_groupのPKであるgroup_relation_idはこのdtoの扱いません。内部的なキーはgetKyeValuesメソッドで定義してあります。
* @author Taejin Hong
* @version 1.1.0
*/
public class ChatGroupDto extends AbstractDto {
public int groupId;
public int parentGroupId = 0;
public String groupName;
public int contentCount = 0;
public String displayCount;
public String groupPath;
public String favoriteRegisterDate = "";
public int delFlg;
public List<ShopMemberDto> groupMembers;
public List<String> groupPathList;
public String updateDate;
public ChatGroupDto() {
}
public ChatGroupDto(int groupId, String groupName, int parentGroupId) {
this.groupId = groupId;
this.groupName = groupName;
this.parentGroupId = parentGroupId;
}
@Override
public Object[] getInsertValues() {
return new Object[]{ groupId, parentGroupId, groupName };
}
@Override
public String[] getKeyValues() {
return new String[]{"" + groupId};
}
}
...@@ -11,13 +11,13 @@ import java.util.Map; ...@@ -11,13 +11,13 @@ import java.util.Map;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants; import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao; import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ChatGroupDao;
import jp.agentec.abook.abv.bl.data.dao.ChatMessageDao; import jp.agentec.abook.abv.bl.data.dao.ChatMessageDao;
import jp.agentec.abook.abv.bl.data.dao.ChatRoomDao; import jp.agentec.abook.abv.bl.data.dao.ChatRoomDao;
import jp.agentec.abook.abv.bl.data.dao.GroupDao;
import jp.agentec.abook.abv.bl.data.dao.ShopMemberDao; import jp.agentec.abook.abv.bl.data.dao.ShopMemberDao;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto; import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto; import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.GroupDto; import jp.agentec.abook.abv.bl.dto.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto; import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.ArrayUtil; import jp.agentec.adf.util.ArrayUtil;
import jp.agentec.adf.util.CollectionUtil; import jp.agentec.adf.util.CollectionUtil;
...@@ -33,7 +33,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -33,7 +33,7 @@ public class CommunicationLogic extends AbstractLogic {
private ChatRoomDao chatRoomDao = AbstractDao.getDao(ChatRoomDao.class); private ChatRoomDao chatRoomDao = AbstractDao.getDao(ChatRoomDao.class);
private ChatMessageDao chatMessageDao = AbstractDao.getDao(ChatMessageDao.class); private ChatMessageDao chatMessageDao = AbstractDao.getDao(ChatMessageDao.class);
private ShopMemberDao shopMemberDao = AbstractDao.getDao(ShopMemberDao.class); private ShopMemberDao shopMemberDao = AbstractDao.getDao(ShopMemberDao.class);
private GroupDao groupDao = AbstractDao.getDao(GroupDao.class); private ChatGroupDao chatGroupDao = AbstractDao.getDao(ChatGroupDao.class);
/** /**
* {@link CommunicationLogic} クラスのインスタンスを初期化します。 * {@link CommunicationLogic} クラスのインスタンスを初期化します。
...@@ -147,12 +147,12 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -147,12 +147,12 @@ public class CommunicationLogic extends AbstractLogic {
public String getNameCardInfo(Integer shopMemberId) { public String getNameCardInfo(Integer shopMemberId) {
JSONObject resultJson = new JSONObject(); JSONObject resultJson = new JSONObject();
ShopMemberDto shopMemberDto = shopMemberDao.getShopMember(shopMemberId); ShopMemberDto shopMemberDto = shopMemberDao.getShopMember(shopMemberId);
List<GroupDto> groupPathList = groupDao.getUserGroupPathList(shopMemberId); List<ChatGroupDto> groupPathList = chatGroupDao.getUserGroupPathList(shopMemberId);
JSONArray groupPathArray = new JSONArray(); JSONArray groupPathArray = new JSONArray();
for (GroupDto groupDto : groupPathList){ for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>(); Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId); groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath); groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap); JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject); groupPathArray.put(jsonObject);
} }
...@@ -168,7 +168,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -168,7 +168,7 @@ public class CommunicationLogic extends AbstractLogic {
public String getMyInfo() { public String getMyInfo() {
ShopMemberDto myInfo = shopMemberDao.getMyInfo(); ShopMemberDto myInfo = shopMemberDao.getMyInfo();
List<String> groupPathList = groupDao.getMyGroupPathList(); List<String> groupPathList = chatGroupDao.getMyGroupPathList();
JSONObject myInfoJson = new JSONObject(); JSONObject myInfoJson = new JSONObject();
myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, myInfo.shopMemberId); myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, myInfo.shopMemberId);
myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, myInfo.shopMemberName); myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, myInfo.shopMemberName);
...@@ -179,13 +179,13 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -179,13 +179,13 @@ public class CommunicationLogic extends AbstractLogic {
} }
public String getMyGroupUsers() { public String getMyGroupUsers() {
List<GroupDto> myGroupIds = groupDao.getMyGroups(); List<ChatGroupDto> myGroupIds = chatGroupDao.getMyGroups();
JSONArray myGroupUsersJson = new JSONArray(); JSONArray myGroupUsersJson = new JSONArray();
for (GroupDto groupDto : myGroupIds) { for (ChatGroupDto chatGroupDto : myGroupIds) {
JSONObject groupUserJson = new JSONObject(); JSONObject groupUserJson = new JSONObject();
groupUserJson.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId); groupUserJson.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupUserJson.put(ABookCommConstants.KEY.GROUP_NAME, groupDto.groupName); groupUserJson.put(ABookCommConstants.KEY.GROUP_NAME, chatGroupDto.groupName);
List<ShopMemberDto> groupUsers = shopMemberDao.getUserListByGroupId(groupDto.groupId); List<ShopMemberDto> groupUsers = shopMemberDao.getUserListByGroupId(chatGroupDto.groupId);
JSONArray groupUserArray = new JSONArray(); JSONArray groupUserArray = new JSONArray();
for (ShopMemberDto groupUser : groupUsers) { for (ShopMemberDto groupUser : groupUsers) {
Map<String, Object> myGroupUserMap = new HashMap<String, Object>(); Map<String, Object> myGroupUserMap = new HashMap<String, Object>();
...@@ -210,13 +210,13 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -210,13 +210,13 @@ public class CommunicationLogic extends AbstractLogic {
} }
public String getMyGroupUsersNotInRoom(Integer roomId) { public String getMyGroupUsersNotInRoom(Integer roomId) {
List<GroupDto> myGroupIds = groupDao.getMyGroups(); List<ChatGroupDto> myGroupIds = chatGroupDao.getMyGroups();
JSONArray myGroupUsersJson = new JSONArray(); JSONArray myGroupUsersJson = new JSONArray();
for (GroupDto groupDto : myGroupIds) { for (ChatGroupDto chatGroupDto : myGroupIds) {
JSONObject groupUserJson = new JSONObject(); JSONObject groupUserJson = new JSONObject();
groupUserJson.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId); groupUserJson.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupUserJson.put(ABookCommConstants.KEY.GROUP_NAME, groupDto.groupName); groupUserJson.put(ABookCommConstants.KEY.GROUP_NAME, chatGroupDto.groupName);
List<ShopMemberDto> groupUsers = shopMemberDao.getUserListNotInRoomByGroupId(groupDto.groupId, roomId); List<ShopMemberDto> groupUsers = shopMemberDao.getUserListNotInRoomByGroupId(chatGroupDto.groupId, roomId);
JSONArray groupUserArray = new JSONArray(); JSONArray groupUserArray = new JSONArray();
for (ShopMemberDto groupUser : groupUsers) { for (ShopMemberDto groupUser : groupUsers) {
Map<String, Object> myGroupUserMap = new HashMap<String, Object>(); Map<String, Object> myGroupUserMap = new HashMap<String, Object>();
...@@ -248,12 +248,12 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -248,12 +248,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto shopMember : selectedShopMembers) { for (ShopMemberDto shopMember : selectedShopMembers) {
Map<String, Object> userMap = new HashMap<String, Object>(); Map<String, Object> userMap = new HashMap<String, Object>();
List<GroupDto> groupPathList = groupDao.getUserGroupPathList(shopMember.shopMemberId); List<ChatGroupDto> groupPathList = chatGroupDao.getUserGroupPathList(shopMember.shopMemberId);
JSONArray groupPathArray = new JSONArray(); JSONArray groupPathArray = new JSONArray();
for (GroupDto groupDto : groupPathList){ for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>(); Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId); groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath); groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap); JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject); groupPathArray.put(jsonObject);
} }
...@@ -282,12 +282,12 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -282,12 +282,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto shopMember : selectedShopMembers) { for (ShopMemberDto shopMember : selectedShopMembers) {
Map<String, Object> userMap = new HashMap<String, Object>(); Map<String, Object> userMap = new HashMap<String, Object>();
List<GroupDto> groupPathList = groupDao.getUserGroupPathList(shopMember.shopMemberId); List<ChatGroupDto> groupPathList = chatGroupDao.getUserGroupPathList(shopMember.shopMemberId);
JSONArray groupPathArray = new JSONArray(); JSONArray groupPathArray = new JSONArray();
for (GroupDto groupDto : groupPathList){ for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>(); Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId); groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath); groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap); JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject); groupPathArray.put(jsonObject);
} }
...@@ -315,12 +315,12 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -315,12 +315,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto shopMember : selectedShopMembers) { for (ShopMemberDto shopMember : selectedShopMembers) {
Map<String, Object> userMap = new HashMap<String, Object>(); Map<String, Object> userMap = new HashMap<String, Object>();
List<GroupDto> groupPathList = groupDao.getUserGroupPathList(shopMember.shopMemberId); List<ChatGroupDto> groupPathList = chatGroupDao.getUserGroupPathList(shopMember.shopMemberId);
JSONArray groupPathArray = new JSONArray(); JSONArray groupPathArray = new JSONArray();
for (GroupDto groupDto : groupPathList){ for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>(); Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId); groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath); groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap); JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject); groupPathArray.put(jsonObject);
} }
...@@ -350,12 +350,12 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -350,12 +350,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto shopMember : selectedShopMembers) { for (ShopMemberDto shopMember : selectedShopMembers) {
Map<String, Object> userMap = new HashMap<String, Object>(); Map<String, Object> userMap = new HashMap<String, Object>();
List<GroupDto> groupPathList = groupDao.getUserGroupPathList(shopMember.shopMemberId); List<ChatGroupDto> groupPathList = chatGroupDao.getUserGroupPathList(shopMember.shopMemberId);
JSONArray groupPathArray = new JSONArray(); JSONArray groupPathArray = new JSONArray();
for (GroupDto groupDto : groupPathList){ for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>(); Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId); groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath); groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap); JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject); groupPathArray.put(jsonObject);
} }
...@@ -378,10 +378,10 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -378,10 +378,10 @@ public class CommunicationLogic extends AbstractLogic {
public String getGroupByName(String keyword) { public String getGroupByName(String keyword) {
String[] replacedKeyword = keyword.replaceAll(" ", " ").split(" "); String[] replacedKeyword = keyword.replaceAll(" ", " ").split(" ");
List<GroupDto> searchGroups = groupDao.getGroupByName(replacedKeyword); List<ChatGroupDto> searchGroups = chatGroupDao.getGroupByName(replacedKeyword);
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (GroupDto group : searchGroups) { for (ChatGroupDto group : searchGroups) {
Map<String, Object> groupMap = new HashMap<String, Object>(); Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName); groupMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName);
groupMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId); groupMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId);
...@@ -399,9 +399,9 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -399,9 +399,9 @@ public class CommunicationLogic extends AbstractLogic {
} }
public String getMyGroupIds() { public String getMyGroupIds() {
List<GroupDto> myGroupList = groupDao.getUserGroups(); List<ChatGroupDto> myGroupList = chatGroupDao.getMyGroups();
String groupIds = ""; String groupIds = "";
for (GroupDto myGroup : myGroupList) { for (ChatGroupDto myGroup : myGroupList) {
if (!groupIds.equals("")) { if (!groupIds.equals("")) {
groupIds = groupIds + ","; groupIds = groupIds + ",";
} }
...@@ -410,8 +410,8 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -410,8 +410,8 @@ public class CommunicationLogic extends AbstractLogic {
return groupIds; return groupIds;
} }
public List<GroupDto> getAllGroup() { public List<ChatGroupDto> getAllGroup() {
return groupDao.getAllGroups(); return chatGroupDao.getAllGroups();
} }
public ChatRoomDto getChatRoom(Integer roomId) { public ChatRoomDto getChatRoom(Integer roomId) {
...@@ -424,12 +424,12 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -424,12 +424,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto favoriteUser : favoriteUsers) { for (ShopMemberDto favoriteUser : favoriteUsers) {
Map<String, Object> favoriteUserMap = new HashMap<String, Object>(); Map<String, Object> favoriteUserMap = new HashMap<String, Object>();
List<GroupDto> groupPathList = groupDao.getUserGroupPathList(favoriteUser.shopMemberId); List<ChatGroupDto> groupPathList = chatGroupDao.getUserGroupPathList(favoriteUser.shopMemberId);
JSONArray groupPathArray = new JSONArray(); JSONArray groupPathArray = new JSONArray();
for (GroupDto groupDto : groupPathList){ for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>(); Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId); groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath); groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap); JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject); groupPathArray.put(jsonObject);
} }
...@@ -454,12 +454,12 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -454,12 +454,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto favoriteUser : favoriteUsers) { for (ShopMemberDto favoriteUser : favoriteUsers) {
Map<String, Object> favoriteUserMap = new HashMap<String, Object>(); Map<String, Object> favoriteUserMap = new HashMap<String, Object>();
List<GroupDto> groupPathList = groupDao.getUserGroupPathList(favoriteUser.shopMemberId); List<ChatGroupDto> groupPathList = chatGroupDao.getUserGroupPathList(favoriteUser.shopMemberId);
JSONArray groupPathArray = new JSONArray(); JSONArray groupPathArray = new JSONArray();
for (GroupDto groupDto : groupPathList){ for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>(); Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId); groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath); groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap); JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject); groupPathArray.put(jsonObject);
} }
...@@ -479,10 +479,10 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -479,10 +479,10 @@ public class CommunicationLogic extends AbstractLogic {
public String getFavoriteGroups() { public String getFavoriteGroups() {
List<GroupDto> favoriteGroups = groupDao.getFavoriteGroup(); List<ChatGroupDto> favoriteGroups = chatGroupDao.getFavoriteGroup();
JSONArray resultJsonArray = new JSONArray(); JSONArray resultJsonArray = new JSONArray();
for (GroupDto favoriteGroup : favoriteGroups) { for (ChatGroupDto favoriteGroup : favoriteGroups) {
Map<String, Object> favoriteGroupMap = new HashMap<String, Object>(); Map<String, Object> favoriteGroupMap = new HashMap<String, Object>();
favoriteGroupMap.put(ABookCommConstants.KEY.GROUP_NAME, favoriteGroup.groupName); favoriteGroupMap.put(ABookCommConstants.KEY.GROUP_NAME, favoriteGroup.groupName);
favoriteGroupMap.put(ABookCommConstants.KEY.GROUP_ID, favoriteGroup.groupId); favoriteGroupMap.put(ABookCommConstants.KEY.GROUP_ID, favoriteGroup.groupId);
...@@ -496,7 +496,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -496,7 +496,7 @@ public class CommunicationLogic extends AbstractLogic {
} }
public Integer getFavoriteCount() { public Integer getFavoriteCount() {
List<GroupDto> favoriteGroups = groupDao.getFavoriteGroup(); List<ChatGroupDto> favoriteGroups = chatGroupDao.getFavoriteGroup();
List<ShopMemberDto> favoriteUsers = shopMemberDao.getfavoriteUserList(); List<ShopMemberDto> favoriteUsers = shopMemberDao.getfavoriteUserList();
return favoriteGroups.size() + favoriteUsers.size(); return favoriteGroups.size() + favoriteUsers.size();
} }
...@@ -507,8 +507,8 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -507,8 +507,8 @@ public class CommunicationLogic extends AbstractLogic {
JSONObject groupSearchData = new JSONObject(); JSONObject groupSearchData = new JSONObject();
//パラメータグループIDが0であれば自分のグループ情報を取得。 //パラメータグループIDが0であれば自分のグループ情報を取得。
GroupDto myGroup = groupDao.getUserGroups().get(0); ChatGroupDto myGroup = chatGroupDao.getMyGroups().get(0);
GroupDto rootGroup = groupDao.getRootGroup(); ChatGroupDto rootGroup = chatGroupDao.getRootGroup();
Integer targetGroupId; Integer targetGroupId;
if (groupId == 0) { if (groupId == 0) {
...@@ -517,7 +517,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -517,7 +517,7 @@ public class CommunicationLogic extends AbstractLogic {
targetGroupId = groupId; targetGroupId = groupId;
} }
GroupDto parentGroup = groupDao.getParentGroup(targetGroupId); ChatGroupDto parentGroup = chatGroupDao.getParentGroup(targetGroupId);
if (parentGroup != null) { if (parentGroup != null) {
groupSearchData.put(ABookCommConstants.KEY.PARENT_GROUP_ID, parentGroup.groupId); groupSearchData.put(ABookCommConstants.KEY.PARENT_GROUP_ID, parentGroup.groupId);
} }
...@@ -526,9 +526,9 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -526,9 +526,9 @@ public class CommunicationLogic extends AbstractLogic {
} }
//グループ //グループ
List<GroupDto> groupPathList = groupDao.getGroupTree(targetGroupId); List<ChatGroupDto> groupPathList = chatGroupDao.getGroupTree(targetGroupId);
JSONArray groupPathJSONArray = new JSONArray(); JSONArray groupPathJSONArray = new JSONArray();
for (GroupDto group : groupPathList) { for (ChatGroupDto group : groupPathList) {
Map<String, Object> groupTreeMap = new HashMap<String, Object>(); Map<String, Object> groupTreeMap = new HashMap<String, Object>();
groupTreeMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName); groupTreeMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName);
groupTreeMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId); groupTreeMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId);
...@@ -537,9 +537,9 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -537,9 +537,9 @@ public class CommunicationLogic extends AbstractLogic {
} }
groupSearchData.put(ABookCommConstants.KEY.GROUP_PATH_LIST,groupPathJSONArray); groupSearchData.put(ABookCommConstants.KEY.GROUP_PATH_LIST,groupPathJSONArray);
List<GroupDto> childGroupList = groupDao.getGroupChildList(targetGroupId); List<ChatGroupDto> childGroupList = chatGroupDao.getGroupChildList(targetGroupId);
JSONArray childGroupJSONArray = new JSONArray(); JSONArray childGroupJSONArray = new JSONArray();
for (GroupDto group : childGroupList) { for (ChatGroupDto group : childGroupList) {
Map<String, Object> groupTreeMap = new HashMap<String, Object>(); Map<String, Object> groupTreeMap = new HashMap<String, Object>();
groupTreeMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName); groupTreeMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName);
groupTreeMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId); groupTreeMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId);
...@@ -562,7 +562,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -562,7 +562,7 @@ public class CommunicationLogic extends AbstractLogic {
shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName); shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
shopMemberMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl); shopMemberMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl);
shopMemberMap.put(ABookCommConstants.KEY.CHECKED, ""); shopMemberMap.put(ABookCommConstants.KEY.CHECKED, "");
shopMemberMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupDao.getUserGroupPathList(shopMember.shopMemberId)); shopMemberMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, chatGroupDao.getUserGroupPathList(shopMember.shopMemberId));
if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) { if (StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) {
shopMemberMap.put(ABookCommConstants.KEY.IS_FAVORITE, false); shopMemberMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
} else { } else {
...@@ -648,32 +648,32 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -648,32 +648,32 @@ public class CommunicationLogic extends AbstractLogic {
//shopMemberDao.deleteShopMemberByList(deleteList); //shopMemberDao.deleteShopMemberByList(deleteList);
} }
public void updateGroup(List<GroupDto> GroupList) { public void updateGroup(List<ChatGroupDto> GroupList) {
List<GroupDto> existGroupList = groupDao.getAllGroups(); List<ChatGroupDto> existGroupList = chatGroupDao.getAllGroups();
ArrayList<GroupDto> insertGroupList = new ArrayList<GroupDto>(); ArrayList<ChatGroupDto> insertGroupList = new ArrayList<ChatGroupDto>();
ArrayList<GroupDto> deleteGroupList = new ArrayList<GroupDto>(); ArrayList<ChatGroupDto> deleteGroupList = new ArrayList<ChatGroupDto>();
ArrayList<GroupDto> updateGroupList = new ArrayList<GroupDto>(); ArrayList<ChatGroupDto> updateGroupList = new ArrayList<ChatGroupDto>();
for (GroupDto groupDto : GroupList) { for (ChatGroupDto chatGroupDto : GroupList) {
if (groupDto.delFlg == 1) { if (chatGroupDto.delFlg == 1) {
deleteGroupList.add(groupDto); deleteGroupList.add(chatGroupDto);
continue; continue;
} }
if (groupDao.getGroup(groupDto.groupId) == null) { if (chatGroupDao.getGroup(chatGroupDto.groupId) == null) {
insertGroupList.add(groupDto); insertGroupList.add(chatGroupDto);
} else { } else {
updateGroupList.add(groupDto); updateGroupList.add(chatGroupDto);
} }
if (groupDto.groupMembers == null) { if (chatGroupDto.groupMembers == null) {
continue; continue;
} }
insertShopMember(groupDto.groupMembers); insertShopMember(chatGroupDto.groupMembers);
} }
groupDao.insertGroupList(insertGroupList); chatGroupDao.insertGroupList(insertGroupList);
groupDao.updateGroupList(updateGroupList); chatGroupDao.updateGroupList(updateGroupList);
groupDao.deleteGroupList(deleteGroupList); chatGroupDao.deleteGroupList(deleteGroupList);
} }
public ShopMemberDto getMyShopMemberDto() { public ShopMemberDto getMyShopMemberDto() {
...@@ -690,10 +690,6 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -690,10 +690,6 @@ public class CommunicationLogic extends AbstractLogic {
shopMemberDao.insertShopMember(shopMemberDto); shopMemberDao.insertShopMember(shopMemberDto);
} }
public void updateMyGroup(List<Integer> groupIds) {
groupDao.updateUserGroupList(groupIds);
}
public void updateFavoriteUser(List<Integer> favoriteUserIds){ public void updateFavoriteUser(List<Integer> favoriteUserIds){
for (Integer favoriteUserId : favoriteUserIds) { for (Integer favoriteUserId : favoriteUserIds) {
ShopMemberDto favoriteUserDto= new ShopMemberDto(); ShopMemberDto favoriteUserDto= new ShopMemberDto();
...@@ -704,14 +700,14 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -704,14 +700,14 @@ public class CommunicationLogic extends AbstractLogic {
} }
public void updateFavoriteGroup(List<Integer> favoriteGroupIds){ public void updateFavoriteGroup(List<Integer> favoriteGroupIds){
List<GroupDto> groupDtos = new ArrayList<GroupDto>(); List<ChatGroupDto> chatGroupDtos = new ArrayList<ChatGroupDto>();
for (Integer favoriteGroupId : favoriteGroupIds) { for (Integer favoriteGroupId : favoriteGroupIds) {
GroupDto groupDto = new GroupDto(); ChatGroupDto chatGroupDto = new ChatGroupDto();
groupDto.groupId = favoriteGroupId; chatGroupDto.groupId = favoriteGroupId;
groupDto.favoriteRegisterDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(new Date(System.currentTimeMillis())); chatGroupDto.favoriteRegisterDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(new Date(System.currentTimeMillis()));
groupDtos.add(groupDto); chatGroupDtos.add(chatGroupDto);
} }
groupDao.updateFavoriteGroupList(groupDtos); chatGroupDao.updateFavoriteGroupList(chatGroupDtos);
} }
public void deleteavoriteUser(List<Integer> favoriteUserIds){ public void deleteavoriteUser(List<Integer> favoriteUserIds){
...@@ -723,17 +719,18 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -723,17 +719,18 @@ public class CommunicationLogic extends AbstractLogic {
} }
} }
public void deleteavoriteGroup(List<Integer> favoriteGroupIds){ public void deleteavoriteGroup(List<Integer> favoriteGroupIds){
List<GroupDto> groupDtos = new ArrayList<GroupDto>(); List<ChatGroupDto> chatGroupDtos = new ArrayList<ChatGroupDto>();
for (Integer favoriteGroupId : favoriteGroupIds) { for (Integer favoriteGroupId : favoriteGroupIds) {
GroupDto groupDto = new GroupDto(); ChatGroupDto chatGroupDto = new ChatGroupDto();
groupDto.favoriteRegisterDate = null; chatGroupDto.favoriteRegisterDate = null;
groupDto.groupId = favoriteGroupId; chatGroupDto.groupId = favoriteGroupId;
groupDtos.add(groupDto); chatGroupDtos.add(chatGroupDto);
} }
groupDao.updateFavoriteGroupList(groupDtos); chatGroupDao.updateFavoriteGroupList(chatGroupDtos);
} }
public void clearAllData() { public void clearAllData() {
chatGroupDao.deleteChatGroup();
chatMessageDao.deleteChatMessage(); chatMessageDao.deleteChatMessage();
chatRoomDao.deleteChatRoom(); chatRoomDao.deleteChatRoom();
shopMemberDao.deleteShopMember(); shopMemberDao.deleteShopMember();
......
...@@ -54,9 +54,9 @@ import jp.agentec.abook.abv.bl.common.exception.AcmsException; ...@@ -54,9 +54,9 @@ 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.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto; import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto; import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
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.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;
...@@ -1041,7 +1041,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -1041,7 +1041,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
MyInfoJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMyInfo(sid); MyInfoJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMyInfo(sid);
if (resultJson.shopMemberDto != null) { if (resultJson.shopMemberDto != null) {
communicationLogic.insertMyInfo(resultJson.shopMemberDto); communicationLogic.insertMyInfo(resultJson.shopMemberDto);
communicationLogic.updateMyGroup(resultJson.shopMemberDto.groupIdList);
} }
} }
...@@ -1109,7 +1108,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -1109,7 +1108,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
if (groupIds.equals(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString())) { if (groupIds.equals(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString())) {
editor.putString(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString(),resultJson.allGroupLastUpdateDate); editor.putString(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString(),resultJson.allGroupLastUpdateDate);
} else { } else {
for (GroupDto groupDto : resultJson.groupList) { for (ChatGroupDto groupDto : resultJson.groupList) {
editor.putString(Integer.toString(groupDto.groupId),groupDto.updateDate); editor.putString(Integer.toString(groupDto.groupId),groupDto.updateDate);
} }
} }
...@@ -1133,9 +1132,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -1133,9 +1132,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private void updateAllGroupInfo() throws NetworkDisconnectedException, AcmsException { private void updateAllGroupInfo() throws NetworkDisconnectedException, AcmsException {
updateGroupInfoFromServer(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString()); updateGroupInfoFromServer(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString());
List<GroupDto> groupList = communicationLogic.getAllGroup(); List<ChatGroupDto> groupList = communicationLogic.getAllGroup();
for (GroupDto group : groupList) { for (ChatGroupDto group : groupList) {
updateGroupInfoFromServer(Integer.toString(group.groupId)); updateGroupInfoFromServer(Integer.toString(group.groupId));
} }
} }
......
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