Commit 9816e8e3 by Lee Munkyeong

コードレビュー対応。

parent ec675abc
......@@ -114,9 +114,9 @@ public class ChatRoomDao extends AbstractDao {
}
public void insertChatRoomUsers(List<Integer> attendUsers, Integer chatRoomId) {
for (Integer attendUserId : attendUsers) {
insert("insert or replace into r_chat_room_shop_member (chat_room_id, shop_member_id) values (?,?)", new Integer[]{chatRoomId, attendUserId});
}
for (Integer attendUserId : attendUsers) {
insert("insert or replace into r_chat_room_shop_member (chat_room_id, shop_member_id) values (?,?)", new Integer[]{chatRoomId, attendUserId});
}
}
public boolean updateChatRoom(ChatRoomDto dto) {
......
......@@ -555,7 +555,7 @@ public class GroupDao extends AbstractDao {
}
public GroupDto getParentGroup(Integer childGroupId) {
return rawQueryGetDto("select parent.* from m_group parent inner join m_group child on child.parent_group_id = parent.group_id where child.group_id = ?",new String[]{""+ childGroupId}, GroupDto.class);
return rawQueryGetDto("select parent.* from m_group parent inner join m_group child on child.parent_group_id = parent.group_id where child.group_id = ?", new String[]{""+ childGroupId}, GroupDto.class);
}
public boolean isExistParent(int baseId) {
......
......@@ -109,11 +109,8 @@ public class CommunicationLogic extends AbstractLogic {
resultJson.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMemberDto.shopMemberName);
resultJson.put(ABookCommConstants.KEY.PROFILE_URL, shopMemberDto.profileUrl);
resultJson.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathList);
if (StringUtil.isNullOrEmpty(shopMemberDto.favoriteRegisterDate)) {
resultJson.put(ABookCommConstants.KEY.IS_FAVORITE, false);
} else {
resultJson.put(ABookCommConstants.KEY.IS_FAVORITE, true);
}
boolean hasRegisteredDate = StringUtil.isNullOrEmpty(shopMemberDto.favoriteRegisterDate) == false;
resultJson.put(ABookCommConstants.KEY.IS_FAVORITE, hasRegisteredDate);
return resultJson.toString();
}
......@@ -304,10 +301,10 @@ public class CommunicationLogic extends AbstractLogic {
GroupDto parentGroup = groupDao.getParentGroup(targetGroupId);
if (parentGroup != null) {
groupSearchData.put(ABookCommConstants.KEY.PARENT_GROUP_ID,parentGroup.groupId);
groupSearchData.put(ABookCommConstants.KEY.PARENT_GROUP_ID, parentGroup.groupId);
}
if (rootGroup != null) {
groupSearchData.put(ABookCommConstants.KEY.ROOT_GROUP_ID,rootGroup.groupId);
groupSearchData.put(ABookCommConstants.KEY.ROOT_GROUP_ID, rootGroup.groupId);
}
//グループ
......
......@@ -828,14 +828,13 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@JavascriptInterface
public void addFavoriteUser(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
boolean result = insertFavoriteUser(shopMemberId);
if (result) {
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl("javascript:CHAT_UI.refreshContactScreen();");
}
});
}
if (!result) { return; }
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl("javascript:CHAT_UI.refreshContactScreen();");
}
});
}
@JavascriptInterface
......@@ -901,17 +900,20 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
private void updateUserInfoFromServer(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
MyInfoJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getNameCard(sid, shopMemberId);
MyInfoJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter)
.getNameCard(sid, shopMemberId);
communicationLogic.insertShopMember(resultJson.shopMemberDto);
}
private boolean insertFavoriteUser(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).insertFavoriteUser(sid, Integer.parseInt(shopMemberId));
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter)
.insertFavoriteUser(sid, Integer.parseInt(shopMemberId));
return result;
}
private boolean deleteFavoriteUser(String shopMemberId) throws NetworkDisconnectedException, AcmsException {
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).deleteFavoriteUser(sid, Integer.parseInt(shopMemberId));
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter)
.deleteFavoriteUser(sid, Integer.parseInt(shopMemberId));
if (result) {
List<Integer> deleteFavoriteList = new ArrayList<Integer>();
deleteFavoriteList.add(Integer.parseInt(shopMemberId));
......@@ -921,18 +923,21 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
private boolean insertFavoriteGroup(String groupId) throws NetworkDisconnectedException, AcmsException {
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).insertFavoriteGroup(sid, Integer.parseInt(groupId));
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter)
.insertFavoriteGroup(sid, Integer.parseInt(groupId));
return result;
}
private boolean deleteFavoriteGroup(String groupId) throws NetworkDisconnectedException, AcmsException {
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).deleteFavoriteGroup(sid, Integer.parseInt(groupId));
if (result) {
List<Integer> deleteFavoriteList = new ArrayList<Integer>();
deleteFavoriteList.add(Integer.parseInt(groupId));
communicationLogic.deleteavoriteGroup(deleteFavoriteList);
}
return result;
boolean result = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter)
.deleteFavoriteGroup(sid, Integer.parseInt(groupId));
if (!result) { return false; }
List<Integer> deleteFavoriteList = new ArrayList<Integer>();
deleteFavoriteList.add(Integer.parseInt(groupId));
communicationLogic.deleteavoriteGroup(deleteFavoriteList);
return true;
}
private void updateGroupInfoFromServer(String groupIds) throws NetworkDisconnectedException, AcmsException {
......@@ -950,10 +955,10 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
SharedPreferences.Editor editor = pref.edit();
communicationLogic.updateGroup(resultJson.groupList);
if (groupIds.equals(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString())) {
editor.putString(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString(),resultJson.allGroupLastUpdateDate);
editor.putString(ABookCommConstants.FLAG.GROUP_REQUEST_ALL.toString(), resultJson.allGroupLastUpdateDate);
} else {
for (GroupDto groupDto : resultJson.groupList) {
editor.putString(Integer.toString(groupDto.groupId),groupDto.updateDate);
editor.putString(Integer.toString(groupDto.groupId), groupDto.updateDate);
}
}
editor.commit();
......
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