Commit 795a5353 by Lee Munkyeong

テーブル作成

parent e74692c5
......@@ -8,16 +8,13 @@ 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.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeUtil;
public class GroupListJSON extends AcmsCommonJSON {
public ArrayList<GroupDto> groupList;
public ArrayList<ChatGroupDto> groupList;
public String allGroupLastUpdateDate;
public GroupListJSON(String jsonString) throws AcmsException {
......@@ -34,14 +31,14 @@ public class GroupListJSON extends AcmsCommonJSON {
JSONArray groupListJsonArray = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONArray(ABookCommConstants.KEY.GROUP_INFO_LIST);
if (groupListJsonArray == null) { return; }
groupList = new ArrayList<GroupDto>();
groupList = new ArrayList<ChatGroupDto>();
for (int listCount = 0; listCount < groupListJsonArray.length(); listCount++) {
if (groupListJsonArray.getJSONObject(listCount).length() == 0) {
break;
}
JSONObject groupJSON = groupListJsonArray.getJSONObject(listCount);
GroupDto groupDto = new GroupDto();
ChatGroupDto groupDto = new ChatGroupDto();
groupDto.groupId = groupJSON.getInt(ABookCommConstants.KEY.GROUP_ID);
if (groupJSON.has(ABookCommConstants.KEY.PARENT_GROUP_ID)) {
......
......@@ -6,6 +6,7 @@ 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;
......@@ -44,10 +45,24 @@ public class ChatGroupDao extends AbstractDao {
sql.append(" ,parent_group_id ");
sql.append(" ,group_name ");
sql.append(" ,favorite_register_date ");
sql.append(" FROM n_chat_group");
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 ");
......@@ -115,6 +130,20 @@ public class ChatGroupDao extends AbstractDao {
}
}
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);
}
......@@ -138,7 +167,7 @@ public class ChatGroupDao extends AbstractDao {
if (CollectionUtil.isNotEmpty(whereSqlList)) {
sql.append("WHERE " + StringUtil.join(" AND ", whereSqlList));
}
sql.append(" ORDER BY group_id ");
sql.append(" ORDER BY group_name ASC ");
return rawQueryGetDtoList(sql.toString(), null, ChatGroupDto.class);
}
......@@ -147,9 +176,9 @@ public class ChatGroupDao extends AbstractDao {
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(" 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(" 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 ");
......@@ -176,18 +205,18 @@ public class ChatGroupDao extends AbstractDao {
return rawQueryGetInt("select * from m_chat_group where parent_group_id = " + baseId, null) > 0;
}
public List<ChatGroupDto> getUserGroups() {
return rawQueryGetDtoList("select * from m_chat_group where user_group_flg = 1 ORDER BY group_name", null, ChatGroupDto.class);
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, group_path, group_level, user_group_flg) ");
sql.append(" VALUES (?,?,?,?,?,?) ");
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, ""+ groupDto.groupId, 0, 0 });
insert(sql.toString(), new Object[] { groupDto.groupId, groupDto.parentGroupId, groupDto.groupName});
}
commit();
} catch (Exception e) {
......
......@@ -347,7 +347,6 @@ public class ShopMemberDao extends AbstractDao {
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) {
......
......@@ -25,7 +25,7 @@ public class MChatGroup extends SQLiteTableScript {
// since DatabaseVersions.Ver1_0_0
sql.append(" CREATE TABLE m_chat_group ( ");
sql.append(" , group_id INTEGER NOT NULL ");
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) ");
......
......@@ -10,7 +10,7 @@ import java.util.List;
*/
public class ChatGroupDto extends AbstractDto {
public int groupId;
public int parentGroupId;
public int parentGroupId = 0;
public String groupName;
public int contentCount = 0;
public String displayCount;
......
......@@ -11,13 +11,13 @@ import java.util.Map;
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.ChatGroupDao;
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.GroupDao;
import jp.agentec.abook.abv.bl.data.dao.ShopMemberDao;
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.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.ArrayUtil;
import jp.agentec.adf.util.CollectionUtil;
......@@ -33,7 +33,7 @@ public class CommunicationLogic extends AbstractLogic {
private ChatRoomDao chatRoomDao = AbstractDao.getDao(ChatRoomDao.class);
private ChatMessageDao chatMessageDao = AbstractDao.getDao(ChatMessageDao.class);
private ShopMemberDao shopMemberDao = AbstractDao.getDao(ShopMemberDao.class);
private GroupDao groupDao = AbstractDao.getDao(GroupDao.class);
private ChatGroupDao chatGroupDao = AbstractDao.getDao(ChatGroupDao.class);
/**
* {@link CommunicationLogic} クラスのインスタンスを初期化します。
......@@ -147,12 +147,12 @@ public class CommunicationLogic extends AbstractLogic {
public String getNameCardInfo(Integer shopMemberId) {
JSONObject resultJson = new JSONObject();
ShopMemberDto shopMemberDto = shopMemberDao.getShopMember(shopMemberId);
List<GroupDto> groupPathList = groupDao.getUserGroupPathList(shopMemberId);
List<ChatGroupDto> groupPathList = chatGroupDao.getUserGroupPathList(shopMemberId);
JSONArray groupPathArray = new JSONArray();
for (GroupDto groupDto : groupPathList){
for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath);
groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject);
}
......@@ -168,7 +168,7 @@ public class CommunicationLogic extends AbstractLogic {
public String getMyInfo() {
ShopMemberDto myInfo = shopMemberDao.getMyInfo();
List<String> groupPathList = groupDao.getMyGroupPathList();
List<String> groupPathList = chatGroupDao.getMyGroupPathList();
JSONObject myInfoJson = new JSONObject();
myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, myInfo.shopMemberId);
myInfoJson.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, myInfo.shopMemberName);
......@@ -179,13 +179,13 @@ public class CommunicationLogic extends AbstractLogic {
}
public String getMyGroupUsers() {
List<GroupDto> myGroupIds = groupDao.getMyGroups();
List<ChatGroupDto> myGroupIds = chatGroupDao.getMyGroups();
JSONArray myGroupUsersJson = new JSONArray();
for (GroupDto groupDto : myGroupIds) {
for (ChatGroupDto chatGroupDto : myGroupIds) {
JSONObject groupUserJson = new JSONObject();
groupUserJson.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId);
groupUserJson.put(ABookCommConstants.KEY.GROUP_NAME, groupDto.groupName);
List<ShopMemberDto> groupUsers = shopMemberDao.getUserListByGroupId(groupDto.groupId);
groupUserJson.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupUserJson.put(ABookCommConstants.KEY.GROUP_NAME, chatGroupDto.groupName);
List<ShopMemberDto> groupUsers = shopMemberDao.getUserListByGroupId(chatGroupDto.groupId);
JSONArray groupUserArray = new JSONArray();
for (ShopMemberDto groupUser : groupUsers) {
Map<String, Object> myGroupUserMap = new HashMap<String, Object>();
......@@ -210,13 +210,13 @@ public class CommunicationLogic extends AbstractLogic {
}
public String getMyGroupUsersNotInRoom(Integer roomId) {
List<GroupDto> myGroupIds = groupDao.getMyGroups();
List<ChatGroupDto> myGroupIds = chatGroupDao.getMyGroups();
JSONArray myGroupUsersJson = new JSONArray();
for (GroupDto groupDto : myGroupIds) {
for (ChatGroupDto chatGroupDto : myGroupIds) {
JSONObject groupUserJson = new JSONObject();
groupUserJson.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId);
groupUserJson.put(ABookCommConstants.KEY.GROUP_NAME, groupDto.groupName);
List<ShopMemberDto> groupUsers = shopMemberDao.getUserListNotInRoomByGroupId(groupDto.groupId, roomId);
groupUserJson.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupUserJson.put(ABookCommConstants.KEY.GROUP_NAME, chatGroupDto.groupName);
List<ShopMemberDto> groupUsers = shopMemberDao.getUserListNotInRoomByGroupId(chatGroupDto.groupId, roomId);
JSONArray groupUserArray = new JSONArray();
for (ShopMemberDto groupUser : groupUsers) {
Map<String, Object> myGroupUserMap = new HashMap<String, Object>();
......@@ -248,12 +248,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto shopMember : selectedShopMembers) {
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();
for (GroupDto groupDto : groupPathList){
for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath);
groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject);
}
......@@ -282,12 +282,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto shopMember : selectedShopMembers) {
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();
for (GroupDto groupDto : groupPathList){
for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath);
groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject);
}
......@@ -315,12 +315,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto shopMember : selectedShopMembers) {
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();
for (GroupDto groupDto : groupPathList){
for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath);
groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject);
}
......@@ -350,12 +350,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto shopMember : selectedShopMembers) {
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();
for (GroupDto groupDto : groupPathList){
for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath);
groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject);
}
......@@ -378,10 +378,10 @@ public class CommunicationLogic extends AbstractLogic {
public String getGroupByName(String keyword) {
String[] replacedKeyword = keyword.replaceAll(" ", " ").split(" ");
List<GroupDto> searchGroups = groupDao.getGroupByName(replacedKeyword);
List<ChatGroupDto> searchGroups = chatGroupDao.getGroupByName(replacedKeyword);
JSONArray resultJsonArray = new JSONArray();
for (GroupDto group : searchGroups) {
for (ChatGroupDto group : searchGroups) {
Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName);
groupMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId);
......@@ -399,9 +399,9 @@ public class CommunicationLogic extends AbstractLogic {
}
public String getMyGroupIds() {
List<GroupDto> myGroupList = groupDao.getUserGroups();
List<ChatGroupDto> myGroupList = chatGroupDao.getMyGroups();
String groupIds = "";
for (GroupDto myGroup : myGroupList) {
for (ChatGroupDto myGroup : myGroupList) {
if (!groupIds.equals("")) {
groupIds = groupIds + ",";
}
......@@ -410,8 +410,8 @@ public class CommunicationLogic extends AbstractLogic {
return groupIds;
}
public List<GroupDto> getAllGroup() {
return groupDao.getAllGroups();
public List<ChatGroupDto> getAllGroup() {
return chatGroupDao.getAllGroups();
}
public ChatRoomDto getChatRoom(Integer roomId) {
......@@ -424,12 +424,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto favoriteUser : favoriteUsers) {
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();
for (GroupDto groupDto : groupPathList){
for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath);
groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject);
}
......@@ -454,12 +454,12 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto favoriteUser : favoriteUsers) {
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();
for (GroupDto groupDto : groupPathList){
for (ChatGroupDto chatGroupDto : groupPathList){
Map<String, Object> groupMap = new HashMap<String, Object>();
groupMap.put(ABookCommConstants.KEY.GROUP_ID, groupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, groupDto.groupPath);
groupMap.put(ABookCommConstants.KEY.GROUP_ID, chatGroupDto.groupId);
groupMap.put(ABookCommConstants.KEY.GROUP_PATH, chatGroupDto.groupPath);
JSONObject jsonObject = new JSONObject(groupMap);
groupPathArray.put(jsonObject);
}
......@@ -479,10 +479,10 @@ public class CommunicationLogic extends AbstractLogic {
public String getFavoriteGroups() {
List<GroupDto> favoriteGroups = groupDao.getFavoriteGroup();
List<ChatGroupDto> favoriteGroups = chatGroupDao.getFavoriteGroup();
JSONArray resultJsonArray = new JSONArray();
for (GroupDto favoriteGroup : favoriteGroups) {
for (ChatGroupDto favoriteGroup : favoriteGroups) {
Map<String, Object> favoriteGroupMap = new HashMap<String, Object>();
favoriteGroupMap.put(ABookCommConstants.KEY.GROUP_NAME, favoriteGroup.groupName);
favoriteGroupMap.put(ABookCommConstants.KEY.GROUP_ID, favoriteGroup.groupId);
......@@ -496,7 +496,7 @@ public class CommunicationLogic extends AbstractLogic {
}
public Integer getFavoriteCount() {
List<GroupDto> favoriteGroups = groupDao.getFavoriteGroup();
List<ChatGroupDto> favoriteGroups = chatGroupDao.getFavoriteGroup();
List<ShopMemberDto> favoriteUsers = shopMemberDao.getfavoriteUserList();
return favoriteGroups.size() + favoriteUsers.size();
}
......@@ -507,8 +507,8 @@ public class CommunicationLogic extends AbstractLogic {
JSONObject groupSearchData = new JSONObject();
//パラメータグループIDが0であれば自分のグループ情報を取得。
GroupDto myGroup = groupDao.getUserGroups().get(0);
GroupDto rootGroup = groupDao.getRootGroup();
ChatGroupDto myGroup = chatGroupDao.getMyGroups().get(0);
ChatGroupDto rootGroup = chatGroupDao.getRootGroup();
Integer targetGroupId;
if (groupId == 0) {
......@@ -517,7 +517,7 @@ public class CommunicationLogic extends AbstractLogic {
targetGroupId = groupId;
}
GroupDto parentGroup = groupDao.getParentGroup(targetGroupId);
ChatGroupDto parentGroup = chatGroupDao.getParentGroup(targetGroupId);
if (parentGroup != null) {
groupSearchData.put(ABookCommConstants.KEY.PARENT_GROUP_ID, parentGroup.groupId);
}
......@@ -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();
for (GroupDto group : groupPathList) {
for (ChatGroupDto group : groupPathList) {
Map<String, Object> groupTreeMap = new HashMap<String, Object>();
groupTreeMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName);
groupTreeMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId);
......@@ -537,9 +537,9 @@ public class CommunicationLogic extends AbstractLogic {
}
groupSearchData.put(ABookCommConstants.KEY.GROUP_PATH_LIST,groupPathJSONArray);
List<GroupDto> childGroupList = groupDao.getGroupChildList(targetGroupId);
List<ChatGroupDto> childGroupList = chatGroupDao.getGroupChildList(targetGroupId);
JSONArray childGroupJSONArray = new JSONArray();
for (GroupDto group : childGroupList) {
for (ChatGroupDto group : childGroupList) {
Map<String, Object> groupTreeMap = new HashMap<String, Object>();
groupTreeMap.put(ABookCommConstants.KEY.GROUP_NAME, group.groupName);
groupTreeMap.put(ABookCommConstants.KEY.GROUP_ID, group.groupId);
......@@ -562,7 +562,7 @@ public class CommunicationLogic extends AbstractLogic {
shopMemberMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
shopMemberMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl);
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)) {
shopMemberMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
} else {
......@@ -648,32 +648,32 @@ public class CommunicationLogic extends AbstractLogic {
//shopMemberDao.deleteShopMemberByList(deleteList);
}
public void updateGroup(List<GroupDto> GroupList) {
public void updateGroup(List<ChatGroupDto> GroupList) {
List<GroupDto> existGroupList = groupDao.getAllGroups();
ArrayList<GroupDto> insertGroupList = new ArrayList<GroupDto>();
ArrayList<GroupDto> deleteGroupList = new ArrayList<GroupDto>();
ArrayList<GroupDto> updateGroupList = new ArrayList<GroupDto>();
for (GroupDto groupDto : GroupList) {
if (groupDto.delFlg == 1) {
deleteGroupList.add(groupDto);
List<ChatGroupDto> existGroupList = chatGroupDao.getAllGroups();
ArrayList<ChatGroupDto> insertGroupList = new ArrayList<ChatGroupDto>();
ArrayList<ChatGroupDto> deleteGroupList = new ArrayList<ChatGroupDto>();
ArrayList<ChatGroupDto> updateGroupList = new ArrayList<ChatGroupDto>();
for (ChatGroupDto chatGroupDto : GroupList) {
if (chatGroupDto.delFlg == 1) {
deleteGroupList.add(chatGroupDto);
continue;
}
if (groupDao.getGroup(groupDto.groupId) == null) {
insertGroupList.add(groupDto);
if (chatGroupDao.getGroup(chatGroupDto.groupId) == null) {
insertGroupList.add(chatGroupDto);
} else {
updateGroupList.add(groupDto);
updateGroupList.add(chatGroupDto);
}
if (groupDto.groupMembers == null) {
if (chatGroupDto.groupMembers == null) {
continue;
}
insertShopMember(groupDto.groupMembers);
insertShopMember(chatGroupDto.groupMembers);
}
groupDao.insertGroupList(insertGroupList);
groupDao.updateGroupList(updateGroupList);
groupDao.deleteGroupList(deleteGroupList);
chatGroupDao.insertGroupList(insertGroupList);
chatGroupDao.updateGroupList(updateGroupList);
chatGroupDao.deleteGroupList(deleteGroupList);
}
public ShopMemberDto getMyShopMemberDto() {
......@@ -690,10 +690,6 @@ public class CommunicationLogic extends AbstractLogic {
shopMemberDao.insertShopMember(shopMemberDto);
}
public void updateMyGroup(List<Integer> groupIds) {
groupDao.updateUserGroupList(groupIds);
}
public void updateFavoriteUser(List<Integer> favoriteUserIds){
for (Integer favoriteUserId : favoriteUserIds) {
ShopMemberDto favoriteUserDto= new ShopMemberDto();
......@@ -704,14 +700,14 @@ public class CommunicationLogic extends AbstractLogic {
}
public void updateFavoriteGroup(List<Integer> favoriteGroupIds){
List<GroupDto> groupDtos = new ArrayList<GroupDto>();
List<ChatGroupDto> chatGroupDtos = new ArrayList<ChatGroupDto>();
for (Integer favoriteGroupId : favoriteGroupIds) {
GroupDto groupDto = new GroupDto();
groupDto.groupId = favoriteGroupId;
groupDto.favoriteRegisterDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(new Date(System.currentTimeMillis()));
groupDtos.add(groupDto);
ChatGroupDto chatGroupDto = new ChatGroupDto();
chatGroupDto.groupId = favoriteGroupId;
chatGroupDto.favoriteRegisterDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(new Date(System.currentTimeMillis()));
chatGroupDtos.add(chatGroupDto);
}
groupDao.updateFavoriteGroupList(groupDtos);
chatGroupDao.updateFavoriteGroupList(chatGroupDtos);
}
public void deleteavoriteUser(List<Integer> favoriteUserIds){
......@@ -723,17 +719,18 @@ public class CommunicationLogic extends AbstractLogic {
}
}
public void deleteavoriteGroup(List<Integer> favoriteGroupIds){
List<GroupDto> groupDtos = new ArrayList<GroupDto>();
List<ChatGroupDto> chatGroupDtos = new ArrayList<ChatGroupDto>();
for (Integer favoriteGroupId : favoriteGroupIds) {
GroupDto groupDto = new GroupDto();
groupDto.favoriteRegisterDate = null;
groupDto.groupId = favoriteGroupId;
groupDtos.add(groupDto);
ChatGroupDto chatGroupDto = new ChatGroupDto();
chatGroupDto.favoriteRegisterDate = null;
chatGroupDto.groupId = favoriteGroupId;
chatGroupDtos.add(chatGroupDto);
}
groupDao.updateFavoriteGroupList(groupDtos);
chatGroupDao.updateFavoriteGroupList(chatGroupDtos);
}
public void clearAllData() {
chatGroupDao.deleteChatGroup();
chatMessageDao.deleteChatMessage();
chatRoomDao.deleteChatRoom();
shopMemberDao.deleteShopMember();
......
......@@ -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.log.Logger;
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.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.CommunicationLogic;
......@@ -1041,7 +1041,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
MyInfoJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getMyInfo(sid);
if (resultJson.shopMemberDto != null) {
communicationLogic.insertMyInfo(resultJson.shopMemberDto);
communicationLogic.updateMyGroup(resultJson.shopMemberDto.groupIdList);
}
}
......@@ -1109,7 +1108,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
if (groupIds.equals(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString())) {
editor.putString(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString(),resultJson.allGroupLastUpdateDate);
} else {
for (GroupDto groupDto : resultJson.groupList) {
for (ChatGroupDto groupDto : resultJson.groupList) {
editor.putString(Integer.toString(groupDto.groupId),groupDto.updateDate);
}
}
......@@ -1133,9 +1132,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private void updateAllGroupInfo() throws NetworkDisconnectedException, AcmsException {
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));
}
}
......
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