Commit 9816e8e3 by Lee Munkyeong

コードレビュー対応。

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