Commit d7c71ca2 by Lee Munkyeong

お気に入り、検索機能

parent 1164f170
...@@ -23,6 +23,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.ContentCheckDeliverableJSON; ...@@ -23,6 +23,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.ContentCheckDeliverableJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON; import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON; import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON; import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteUserJSON; import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteUserJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupListJSON; import jp.agentec.abook.abv.bl.acms.client.json.GroupListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupsJSON; import jp.agentec.abook.abv.bl.acms.client.json.GroupsJSON;
...@@ -52,6 +53,8 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.DeleteProcessParameters; ...@@ -52,6 +53,8 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.DeleteProcessParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.EnqueteReplyParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.EnqueteReplyParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseLoginParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseNewLoginParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseNewLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.FavoriteGroupParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.FavoriteUserParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetApertureMasterDataParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetApertureMasterDataParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetContentParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetContentParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetEnqueteReplyParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetEnqueteReplyParameters;
...@@ -61,7 +64,6 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.GetMessagesParameters; ...@@ -61,7 +64,6 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.GetMessagesParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetNameCardParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetNameCardParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.InsertFavoriteParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.PasswordChangeParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.PasswordChangeParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.PostEnqueteReplyParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.PostEnqueteReplyParameters;
...@@ -628,24 +630,69 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -628,24 +630,69 @@ public class AcmsClient implements AcmsClientResponseListener {
} }
/** /**
* お気に入り追加。。 * お気に入りユーザ追加。。
* *
* @param sid * @param sid
* @param shopMemberId * @param shopMemberId
* @return * @return 成功有無
* @throws NetworkDisconnectedException * @throws NetworkDisconnectedException
* @throws AcmsException * @throws AcmsException
*/ */
public boolean insertFavoriteUser(String sid, Integer shopMemberId) throws NetworkDisconnectedException, AcmsException { public boolean insertFavoriteUser(String sid, Integer shopMemberId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetFavorite, new InsertFavoriteParameters(sid, AcmsApis.FavoriteCmds.addFavoriteUser, shopMemberId)); HttpResponse response = send(AcmsApis.ApigetFavorite, new FavoriteUserParameters(sid, AcmsApis.FavoriteCmds.addFavoriteUser, shopMemberId));
return response.httpResponseCode == 200; return response.httpResponseCode == 200;
} }
/**
* お気に入りユーザ削除。。
*
* @param sid
* @param shopMemberId
* @return 成功有無
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public boolean deleteFavoriteUser(String sid, Integer shopMemberId) throws NetworkDisconnectedException, AcmsException { public boolean deleteFavoriteUser(String sid, Integer shopMemberId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetFavorite, new InsertFavoriteParameters(sid, AcmsApis.FavoriteCmds.removeFavoriteUser, shopMemberId)); HttpResponse response = send(AcmsApis.ApigetFavorite, new FavoriteUserParameters(sid, AcmsApis.FavoriteCmds.removeFavoriteUser, shopMemberId));
return response.httpResponseCode == 200;
}
/**
* お気に入りグループ追加。
*
* @param sid
* @param groupId
* @return 成功有無
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public boolean insertFavoriteGroup(String sid, Integer groupId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetFavorite, new FavoriteGroupParameters(sid, AcmsApis.FavoriteCmds.addFavoriteGroup, groupId));
return response.httpResponseCode == 200; return response.httpResponseCode == 200;
} }
/**
* お気に入りグループ削除。
*
* @param sid
* @param groupId
* @return 成功有無
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public boolean deleteFavoriteGroup(String sid, Integer groupId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetFavorite, new FavoriteGroupParameters(sid, AcmsApis.FavoriteCmds.removeFavoriteGroup, groupId));
return response.httpResponseCode == 200;
}
/**
* お気に入りユーザ取得。
*
* @param sid
* @return お気に入りユーザのIDリスト。
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public GetFavoriteUserJSON getFavoriteUser(String sid) throws NetworkDisconnectedException, AcmsException { public GetFavoriteUserJSON getFavoriteUser(String sid) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetFavorite, new GetFavoriteParameters(sid, AcmsApis.FavoriteCmds.getFavoriteUser)); HttpResponse response = send(AcmsApis.ApigetFavorite, new GetFavoriteParameters(sid, AcmsApis.FavoriteCmds.getFavoriteUser));
GetFavoriteUserJSON json = new GetFavoriteUserJSON(response.httpResponseBody); GetFavoriteUserJSON json = new GetFavoriteUserJSON(response.httpResponseBody);
...@@ -653,6 +700,20 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -653,6 +700,20 @@ public class AcmsClient implements AcmsClientResponseListener {
} }
/** /**
* お気に入りグループ取得。
*
* @param sid
* @return お気に入りグループのIDリスト。
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public GetFavoriteGroupJSON getFavoriteGroup(String sid) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetFavorite, new GetFavoriteParameters(sid, AcmsApis.FavoriteCmds.getFavoriteGroup));
GetFavoriteGroupJSON json = new GetFavoriteGroupJSON(response.httpResponseBody);
return json;
}
/**
* 作業報告データ送信 * 作業報告データ送信
* @param sid * @param sid
* @param operationId * @param operationId
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import java.util.List;
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;
public class GetFavoriteGroupJSON extends AcmsCommonJSON {
public List<Integer> favoriteGroupIds;
public GetFavoriteGroupJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
favoriteGroupIds = new ArrayList<Integer>();
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONObject responseBodyObject = json.getJSONObject(ABookCommConstants.KEY.BODY);
if (responseBodyObject == null) { return; }
JSONArray favoriteIds = responseBodyObject.getJSONArray(ABookCommConstants.KEY.FAVORITE_GROUP_IDS);
if (favoriteIds == null || favoriteIds.length() == 0) {
return;
}
for (int count = 0; count < favoriteIds.length(); count++) {
favoriteGroupIds.add((Integer)favoriteIds.get(count));
}
}
}
...@@ -21,7 +21,7 @@ public class GetFavoriteUserJSON extends AcmsCommonJSON { ...@@ -21,7 +21,7 @@ public class GetFavoriteUserJSON extends AcmsCommonJSON {
@Override @Override
protected void parse(JSONObject json) throws JSONValidationException { protected void parse(JSONObject json) throws JSONValidationException {
favoriteUserIds = new ArrayList<Integer>();
if (!json.has(ABookCommConstants.KEY.BODY)) { return; } if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONObject responseBodyObject = json.getJSONObject(ABookCommConstants.KEY.BODY); JSONObject responseBodyObject = json.getJSONObject(ABookCommConstants.KEY.BODY);
...@@ -32,7 +32,6 @@ public class GetFavoriteUserJSON extends AcmsCommonJSON { ...@@ -32,7 +32,6 @@ public class GetFavoriteUserJSON extends AcmsCommonJSON {
return; return;
} }
favoriteUserIds = new ArrayList<Integer>();
for (int count = 0; count < favoriteIds.length(); count++) { for (int count = 0; count < favoriteIds.length(); count++) {
favoriteUserIds.add((Integer)favoriteIds.get(count)); favoriteUserIds.add((Integer)favoriteIds.get(count));
} }
......
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* @author Lee-mk
* @version 1.0.0
*/
public class FavoriteGroupParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private Integer targetGroupId;
/**
* {@link FavoriteGroupParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @param targetGroupId お気に入りリクエスト対象になるグループID。
* @since 1.0.0
*/
public FavoriteGroupParameters(String sid, String cmd, Integer targetGroupId) {
this.sid = sid;
this.cmd = cmd;
this.targetGroupId = targetGroupId;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return コマンド。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
/**
* 対象グループIDを返します。
* @return 対象グループID。
* @since 1.0.0
*/
public Integer getTargetGroupId() {
return targetGroupId;
}
}
...@@ -3,12 +3,10 @@ package jp.agentec.abook.abv.bl.acms.client.parameters; ...@@ -3,12 +3,10 @@ package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject; import jp.agentec.adf.net.http.HttpParameterObject;
/** /**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br> * @author Lee-mk
* ただし、このクラスはログイン状態の確認用として使われる {@link InsertFavoriteParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author Taejin Hong
* @version 1.0.0 * @version 1.0.0
*/ */
public class InsertFavoriteParameters extends HttpParameterObject { public class FavoriteUserParameters extends HttpParameterObject {
/** /**
* セッションID * セッションID
* @since 1.0.0 * @since 1.0.0
...@@ -19,12 +17,13 @@ public class InsertFavoriteParameters extends HttpParameterObject { ...@@ -19,12 +17,13 @@ public class InsertFavoriteParameters extends HttpParameterObject {
/** /**
* {@link InsertFavoriteParameters} のインスタンスを初期化します。 * {@link FavoriteUserParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。 * @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。 * @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @param targetUserId お気に入りリクエスト対象になるユーザのID。
* @since 1.0.0 * @since 1.0.0
*/ */
public InsertFavoriteParameters(String sid, String cmd, Integer targetUserId) { public FavoriteUserParameters(String sid, String cmd, Integer targetUserId) {
this.sid = sid; this.sid = sid;
this.cmd = cmd; this.cmd = cmd;
this.targetUserId = targetUserId; this.targetUserId = targetUserId;
...@@ -41,13 +40,18 @@ public class InsertFavoriteParameters extends HttpParameterObject { ...@@ -41,13 +40,18 @@ public class InsertFavoriteParameters extends HttpParameterObject {
/** /**
* コマンドを返します。 * コマンドを返します。
* @return ログインした時のセッションIDです * @return コマンド
* @since 1.0.0 * @since 1.0.0
*/ */
public String getCmd() { public String getCmd() {
return cmd; return cmd;
} }
/**
* 対象ユーザIDを返します。
* @return 対象ユーザID。
* @since 1.0.0
*/
public Integer getTargetUserId() { public Integer getTargetUserId() {
return targetUserId; return targetUserId;
} }
......
...@@ -50,6 +50,7 @@ public interface ABookCommConstants { ...@@ -50,6 +50,7 @@ public interface ABookCommConstants {
String CHAT_ROOM_INFO_LIST = "chatRoomInfoList"; String CHAT_ROOM_INFO_LIST = "chatRoomInfoList";
String LAST_MESSAGE_INFO = "lastMessageInfo"; String LAST_MESSAGE_INFO = "lastMessageInfo";
String FAVORITE_USER_IDS = "favoriteUserIds"; String FAVORITE_USER_IDS = "favoriteUserIds";
String FAVORITE_GROUP_IDS = "favoriteGroupIds";
String ROOT_GROUP_ID = "rootGroupId"; String ROOT_GROUP_ID = "rootGroupId";
......
...@@ -518,6 +518,10 @@ public class GroupDao extends AbstractDao { ...@@ -518,6 +518,10 @@ public class GroupDao extends AbstractDao {
return rawQueryGetDtoList("select * from m_group where favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, GroupDto.class); return rawQueryGetDtoList("select * from m_group where favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, GroupDto.class);
} }
public List<GroupDto> getGroupByName(String groupName) {
return rawQueryGetDtoList("select * from m_group where group_name LIKE '%"+groupName+"%'ORDER BY group_id ", null, GroupDto.class);
}
public List<GroupDto> getGroupSpareList(int baseId, int parentId) { public List<GroupDto> getGroupSpareList(int baseId, int parentId) {
List<GroupDto> list; List<GroupDto> list;
list = rawQueryGetDtoList("select * from m_group mg where (mg.group_id = ?) UNION select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ baseId, ""+ parentId}, GroupDto.class); list = rawQueryGetDtoList("select * from m_group mg where (mg.group_id = ?) UNION select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ baseId, ""+ parentId}, GroupDto.class);
...@@ -615,8 +619,8 @@ public class GroupDao extends AbstractDao { ...@@ -615,8 +619,8 @@ public class GroupDao extends AbstractDao {
public void updateFavoriteGroupList(List<GroupDto> groupList) { public void updateFavoriteGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_group "); sql.append(" UPDATE m_group ");
sql.append(" , favorite_register_date = ? "); sql.append(" SET favorite_register_date = ? ");
sql.append(" WHERE group_id = ? "); sql.append(" WHERE group_id = ? ");
try { try {
beginTransaction(); beginTransaction();
for (GroupDto groupDto : groupList) { for (GroupDto groupDto : groupList) {
......
...@@ -121,6 +121,43 @@ public class ShopMemberDao extends AbstractDao { ...@@ -121,6 +121,43 @@ public class ShopMemberDao extends AbstractDao {
return list; return list;
} }
public List<ShopMemberDto> getUserInMyGroupByName(String shopMemberName) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" sm.shop_member_id ");
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url");
sql.append(" ,sm.favorite_register_date");
sql.append(" FROM ");
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE rsmg.group_id IN (SELECT group_id FROM m_group WHERE user_group_flg = 1)");
sql.append(" AND sm.self_flg != 1");
sql.append(" AND sm.shop_member_name LIKE '%"+shopMemberName+"%' ");
sql.append(" ORDER BY sm.shop_member_name DESC ");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), new String[]{}, ShopMemberDto.class);
return list;
}
public List<ShopMemberDto> getUserInAllGroupByName(String shopMemberName) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" sm.shop_member_id ");
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url");
sql.append(" ,sm.favorite_register_date");
sql.append(" FROM ");
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" AND sm.self_flg != 1");
sql.append(" AND sm.shop_member_name LIKE '%"+shopMemberName+"%' ");
sql.append(" ORDER BY sm.shop_member_name DESC ");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), new String[]{}, ShopMemberDto.class);
return list;
}
public List<ShopMemberDto> getMyGroupUsers() { public List<ShopMemberDto> getMyGroupUsers() {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" SELECT "); sql.append(" SELECT ");
......
...@@ -146,6 +146,77 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -146,6 +146,77 @@ public class CommunicationLogic extends AbstractLogic {
return myInfoStr; return myInfoStr;
} }
public String getMyGroupUserByName(String shopMemberName) {
List<ShopMemberDto> selectedShopMembers = shopMemberDao.getUserInMyGroupByName(shopMemberName);
JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto shopMember : selectedShopMembers) {
Map<String, Object> userMap = new HashMap<String, Object>();
List<String> groupPathList = groupDao.getUserGroupPathList(shopMember.shopMemberId);
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId);
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
userMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl);
userMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathList);
if(StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) {
userMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
} else {
userMap.put(ABookCommConstants.KEY.IS_FAVORITE, true);
}
JSONObject jsonObject = new JSONObject(userMap);
resultJsonArray.put(jsonObject);
}
String searchUserStr = resultJsonArray.toString();
return searchUserStr;
}
public String getAllGroupShopMemberByName(String shopMemberName) {
List<ShopMemberDto> selectedShopMembers = shopMemberDao.getUserInAllGroupByName(shopMemberName);
JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto shopMember : selectedShopMembers) {
Map<String, Object> userMap = new HashMap<String, Object>();
List<String> groupPathList = groupDao.getUserGroupPathList(shopMember.shopMemberId);
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMember.shopMemberId);
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMember.shopMemberName);
userMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMember.profileUrl);
userMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathList);
if(StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) {
userMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
} else {
userMap.put(ABookCommConstants.KEY.IS_FAVORITE, true);
}
JSONObject jsonObject = new JSONObject(userMap);
resultJsonArray.put(jsonObject);
}
String searchUserStr = resultJsonArray.toString();
return searchUserStr;
}
public String getGroupByName(String groupName) {
List<GroupDto> searchGroups = groupDao.getGroupByName(groupName);
JSONArray resultJsonArray = new JSONArray();
for (GroupDto 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);
if(StringUtil.isNullOrEmpty(group.favoriteRegisterDate)) {
groupMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
} else {
groupMap.put(ABookCommConstants.KEY.IS_FAVORITE, true);
}
JSONObject jsonObject = new JSONObject(groupMap);
resultJsonArray.put(jsonObject);
}
String groupsStr = resultJsonArray.toString();
return groupsStr;
}
public String getMyGroupIds() { public String getMyGroupIds() {
List<GroupDto> myGroupList = groupDao.getUserGroups(); List<GroupDto> myGroupList = groupDao.getUserGroups();
String groupIds = ""; String groupIds = "";
...@@ -257,6 +328,11 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -257,6 +328,11 @@ 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.GROUP_PATH_LIST, groupDao.getUserGroupPathList(shopMember.shopMemberId)); shopMemberMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupDao.getUserGroupPathList(shopMember.shopMemberId));
if(StringUtil.isNullOrEmpty(shopMember.favoriteRegisterDate)) {
shopMemberMap.put(ABookCommConstants.KEY.IS_FAVORITE, false);
} else {
shopMemberMap.put(ABookCommConstants.KEY.IS_FAVORITE, true);
}
JSONObject jsonObject = new JSONObject(shopMemberMap); JSONObject jsonObject = new JSONObject(shopMemberMap);
shopMemberJSONArray.put(jsonObject); shopMemberJSONArray.put(jsonObject);
} }
...@@ -359,6 +435,17 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -359,6 +435,17 @@ public class CommunicationLogic extends AbstractLogic {
} }
} }
public void updateFavoriteGroup(List<Integer> favoriteGroupIds){
List<GroupDto> groupDtos = new ArrayList<GroupDto>();
for (Integer favoriteGroupId : favoriteGroupIds) {
GroupDto groupDto = new GroupDto();
groupDto.groupId = favoriteGroupId;
groupDto.favoriteRegisterDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(new Date(System.currentTimeMillis()));
groupDtos.add(groupDto);
}
groupDao.updateFavoriteGroupList(groupDtos);
}
public void deleteavoriteUser(List<Integer> favoriteUserIds){ public void deleteavoriteUser(List<Integer> favoriteUserIds){
for (Integer favoriteUserId : favoriteUserIds) { for (Integer favoriteUserId : favoriteUserIds) {
ShopMemberDto favoriteUserDto= new ShopMemberDto(); ShopMemberDto favoriteUserDto= new ShopMemberDto();
...@@ -367,4 +454,14 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -367,4 +454,14 @@ public class CommunicationLogic extends AbstractLogic {
shopMemberDao.updateFavoriteUser(favoriteUserDto); shopMemberDao.updateFavoriteUser(favoriteUserDto);
} }
} }
public void deleteavoriteGroup(List<Integer> favoriteGroupIds){
List<GroupDto> groupDtos = new ArrayList<GroupDto>();
for (Integer favoriteGroupId : favoriteGroupIds) {
GroupDto groupDto = new GroupDto();
groupDto.favoriteRegisterDate = null;
groupDto.groupId = favoriteGroupId;
groupDtos.add(groupDto);
}
groupDao.updateFavoriteGroupList(groupDtos);
}
} }
...@@ -36,6 +36,7 @@ import java.util.Objects; ...@@ -36,6 +36,7 @@ import java.util.Objects;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient; import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON; import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteUserJSON; import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteUserJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupListJSON; import jp.agentec.abook.abv.bl.acms.client.json.GroupListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MessageInfoListJSON; import jp.agentec.abook.abv.bl.acms.client.json.MessageInfoListJSON;
...@@ -774,7 +775,25 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -774,7 +775,25 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
String myGroupUsersStr = communicationLogic.getMyGroupUsers(); String myGroupUsersStr = communicationLogic.getMyGroupUsers();
return myGroupUsersStr; return myGroupUsersStr;
} }
@JavascriptInterface
public String getMyGroupShopMemberByName(String shopMemberName) {
String searchUserStr = communicationLogic.getMyGroupUserByName(shopMemberName);
return searchUserStr;
}
@JavascriptInterface
public String getAllGroupShopMemberByName(String shopMemberName) {
String searchUserStr = communicationLogic.getAllGroupShopMemberByName(shopMemberName);
return searchUserStr;
}
@JavascriptInterface
public String getGroupByName(String groupName) {
String searchGroupStr = communicationLogic.getGroupByName(groupName);
return searchGroupStr;
}
@JavascriptInterface @JavascriptInterface
public String getFavoriteGroups() { public String getFavoriteGroups() {
String favoriteGroupsStr = communicationLogic.getFavoriteGroups(); String favoriteGroupsStr = communicationLogic.getFavoriteGroups();
...@@ -830,6 +849,32 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -830,6 +849,32 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
@JavascriptInterface @JavascriptInterface
public void addFavoriteGroup(String groupId) throws NetworkDisconnectedException, AcmsException {
boolean result = insertFavoriteGroup(groupId);
if (result) {
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl("javascript:CHAT_UI.refreshContactScreen();");
}
});
}
}
@JavascriptInterface
public void removeFavoriteGroup(String groupId) throws NetworkDisconnectedException, AcmsException {
boolean result = deleteFavoriteGroup(groupId);
if (result) {
mChatWebView.post(new Runnable() {
@Override
public void run() {
mChatWebView.loadUrl("javascript:CHAT_UI.refreshContactScreen();");
}
});
}
}
@JavascriptInterface
public void updateFavorite() throws NetworkDisconnectedException, AcmsException { public void updateFavorite() throws NetworkDisconnectedException, AcmsException {
updateFavoriteInfo(); updateFavoriteInfo();
} }
...@@ -872,6 +917,21 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -872,6 +917,21 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
return result; return result;
} }
private boolean insertFavoriteGroup(String groupId) throws NetworkDisconnectedException, AcmsException {
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;
}
private void updateGroupInfoFromServer(String groupIds) throws NetworkDisconnectedException, AcmsException { private void updateGroupInfoFromServer(String groupIds) throws NetworkDisconnectedException, AcmsException {
GroupListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getGroupInfo(sid,groupIds,DEFAULT_CHECKSUM); GroupListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getGroupInfo(sid,groupIds,DEFAULT_CHECKSUM);
communicationLogic.updateGroup(resultJson.groupList); communicationLogic.updateGroup(resultJson.groupList);
...@@ -882,6 +942,11 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -882,6 +942,11 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
communicationLogic.updateFavoriteUser(resultJson.favoriteUserIds); communicationLogic.updateFavoriteUser(resultJson.favoriteUserIds);
} }
private void updateFavoriteGroup() throws NetworkDisconnectedException, AcmsException {
GetFavoriteGroupJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getFavoriteGroup(sid);
communicationLogic.updateFavoriteGroup(resultJson.favoriteGroupIds);
}
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<GroupDto> groupList = communicationLogic.getAllGroup();
...@@ -892,10 +957,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -892,10 +957,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private void updateFavoriteInfo() throws NetworkDisconnectedException, AcmsException { private void updateFavoriteInfo() throws NetworkDisconnectedException, AcmsException {
updateFavoriteUser(); updateFavoriteUser();
/*List<GroupDto> groupList = communicationLogic.getAllGroup(); updateFavoriteGroup();
for (GroupDto 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