Commit 8d3bc5b8 by Lee Munkyeong

Merge branch 'features/abcomm_sp5_group_search_UI' into 'features/abcomm_sp5'

Features/abcomm sp5 group search ui

See merge request !94
parents c10ae0b2 9816e8e3
......@@ -23,6 +23,8 @@ 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.CreatedRoomJSON;
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.GroupListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON;
......@@ -51,9 +53,12 @@ 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.EnterpriseLoginParameters;
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.GetContentParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetEnqueteReplyParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetFavoriteParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetGroupInfoParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetMessagesParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetNameCardParameters;
......@@ -603,8 +608,8 @@ public class AcmsClient implements AcmsClientResponseListener {
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public CreatedRoomJSON createRoom(String sid, String roomType, String inviteMemberIds, String newRoomName) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetChatRooms, new CreateRoomParameters(sid, AcmsApis.RoomCmds.createRoom, roomType, inviteMemberIds, newRoomName));
public CreatedRoomJSON createRoom(String sid, String roomType, String inviteMemberIds, String newRoomName, String memberName) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetChatRooms, new CreateRoomParameters(sid, AcmsApis.RoomCmds.createRoom, roomType, inviteMemberIds, newRoomName, memberName));
CreatedRoomJSON json = new CreatedRoomJSON(response.httpResponseBody);
return json;
}
......@@ -625,6 +630,90 @@ public class AcmsClient implements AcmsClientResponseListener {
}
/**
* お気に入りユーザ追加。。
*
* @param sid
* @param shopMemberId
* @return 成功有無
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public boolean insertFavoriteUser(String sid, Integer shopMemberId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetFavorite, new FavoriteUserParameters(sid, AcmsApis.FavoriteCmds.addFavoriteUser, shopMemberId));
return response.httpResponseCode == 200;
}
/**
* お気に入りユーザ削除。。
*
* @param sid
* @param shopMemberId
* @return 成功有無
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public boolean deleteFavoriteUser(String sid, Integer shopMemberId) throws NetworkDisconnectedException, AcmsException {
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;
}
/**
* お気に入りグループ削除。
*
* @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 {
HttpResponse response = send(AcmsApis.ApigetFavorite, new GetFavoriteParameters(sid, AcmsApis.FavoriteCmds.getFavoriteUser));
GetFavoriteUserJSON json = new GetFavoriteUserJSON(response.httpResponseBody);
return json;
}
/**
* お気に入りグループ取得。
*
* @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 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));
}
}
}
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;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
public class GetFavoriteUserJSON extends AcmsCommonJSON {
public List<Integer> favoriteUserIds;
public GetFavoriteUserJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
favoriteUserIds = 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_USER_IDS);
if (favoriteIds == null || favoriteIds.length() == 0) {
return;
}
for (int count = 0; count < favoriteIds.length(); count++) {
favoriteUserIds.add((Integer)favoriteIds.get(count));
}
}
}
......@@ -18,6 +18,7 @@ public class GroupListJSON extends AcmsCommonJSON {
public ArrayList<GroupDto> groupList;
public String allGroupLastUpdateDate;
public GroupListJSON(String jsonString) throws AcmsException {
super(jsonString);
......@@ -28,6 +29,7 @@ public class GroupListJSON extends AcmsCommonJSON {
// ルーム一覧情報を取得
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
if (!json.getJSONObject(ABookCommConstants.KEY.BODY).has(ABookCommConstants.KEY.GROUP_INFO_LIST)) { return; }
JSONArray groupListJsonArray = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONArray(ABookCommConstants.KEY.GROUP_INFO_LIST);
if (groupListJsonArray == null) { return; }
......@@ -47,7 +49,9 @@ public class GroupListJSON extends AcmsCommonJSON {
}
groupDto.groupName = groupJSON.getString(ABookCommConstants.KEY.GROUP_NAME);
groupDto.delFlg = groupJSON.getInt(ABookCommConstants.KEY.DEL_FLG);
if (groupJSON.has(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE)) {
groupDto.updateDate = groupJSON.getString(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE);
}
if (groupJSON.has(ABookCommConstants.KEY.GROUP_MEMBER_LIST)) {
JSONArray groupMemberJsonArray = groupJSON.getJSONArray(ABookCommConstants.KEY.GROUP_MEMBER_LIST);
ArrayList<ShopMemberDto> groupMembers = new ArrayList<ShopMemberDto>();
......@@ -69,6 +73,10 @@ public class GroupListJSON extends AcmsCommonJSON {
}
groupList.add(groupDto);
}
if (json.getJSONObject(ABookCommConstants.KEY.BODY).has(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE)) {
allGroupLastUpdateDate = json.getJSONObject(ABookCommConstants.KEY.BODY).getString(ABookCommConstants.KEY.GROUP_INFO_LAST_UPDATE_DATE);
}
}
}
......@@ -57,6 +57,13 @@ public class RoomListJSON extends AcmsCommonJSON {
chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_ID);
chatRoomDto.lastMessageInfo = chatMessageDto;
}
JSONArray attendUsers = roomListJsonArray.getJSONObject(listCount).getJSONArray(ABookCommConstants.KEY.ATTEND_USERS);
ArrayList<Integer> attendUserList = new ArrayList<Integer>();
for (int attendUserCount = 0; attendUserCount < attendUsers.length(); attendUserCount++) {
attendUserList.add((Integer) attendUsers.get(attendUserCount));
}
chatRoomDto.attendUsers = attendUserList;
roomList.add(chatRoomDto);
}
}
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
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.ShopMemberDto;
public class UserUpdateJSON extends AcmsCommonJSON {
public ShopMemberDto shopMemberDto;
public UserUpdateJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
JSONObject UserInfoJson = json.getJSONObject(ABookCommConstants.KEY.BODY);
if (UserInfoJson == null) { return; }
shopMemberDto = new ShopMemberDto();
ArrayList<Integer> groupIdList = new ArrayList<Integer>();
JSONArray groupIdJsonArray = (JSONArray) UserInfoJson.get(ABookCommConstants.KEY.GROUP_IDS);
for (int i = 0; i < groupIdJsonArray.length(); i++) {
groupIdList.add(groupIdJsonArray.getInt(i));
}
shopMemberDto.groupIdList = groupIdList;
}
}
......@@ -19,6 +19,8 @@ public class CreateRoomParameters extends HttpParameterObject {
private String roomType;
private String inviteMemberIds;
private String newRoomName;
private String memberName;
/**
* {@link CreateRoomParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
......@@ -34,12 +36,13 @@ public class CreateRoomParameters extends HttpParameterObject {
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public CreateRoomParameters(String sid, String cmd, String roomType, String inviteMemberIds, String newRoomName) {
public CreateRoomParameters(String sid, String cmd, String roomType, String inviteMemberIds, String newRoomName, String memberName) {
this.sid = sid;
this.cmd = cmd;
this.roomType = roomType;
this.inviteMemberIds = inviteMemberIds;
this.newRoomName = newRoomName;
this.memberName = memberName;
}
/**
......@@ -71,4 +74,8 @@ public class CreateRoomParameters extends HttpParameterObject {
public String getNewRoomName() {
return newRoomName;
}
public String getMemberName() {
return memberName;
}
}
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;
}
}
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 FavoriteUserParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private Integer targetUserId;
/**
* {@link FavoriteUserParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @param targetUserId お気に入りリクエスト対象になるユーザのID。
* @since 1.0.0
*/
public FavoriteUserParameters(String sid, String cmd, Integer targetUserId) {
this.sid = sid;
this.cmd = cmd;
this.targetUserId = targetUserId;
}
/**
* セッション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 getTargetUserId() {
return targetUserId;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link GetFavoriteParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author Taejin Hong
* @version 1.0.0
*/
public class GetFavoriteParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
/**
* {@link GetFavoriteParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @since 1.0.0
*/
public GetFavoriteParameters(String sid) {
this.sid = sid;
}
/**
* {@link GetFavoriteParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public GetFavoriteParameters(String sid, String cmd) {
this.sid = sid;
this.cmd = cmd;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
}
......@@ -173,6 +173,7 @@ public class AcmsApis {
public static final String ApigetChatRooms = "room";
public static final String ApigetUser = "user";
public static final String ApigetMessage = "message";
public static final String ApigetFavorite = "favorite";
public static final class UserCmds {
public static final String getMyInfo = "9";
......@@ -189,6 +190,15 @@ public class AcmsApis {
public static final String getMessages = "2";
}
public static final class FavoriteCmds {
public static final String addFavoriteUser = "1";
public static final String addFavoriteGroup = "2";
public static final String getFavoriteUser = "4";
public static final String getFavoriteGroup = "5";
public static final String removeFavoriteUser = "7";
public static final String removeFavoriteGroup = "8";
}
// download
/**
* コンテンツのZIPファイルを取得<br>
......@@ -235,7 +245,7 @@ public class AcmsApis {
methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiGetApertureMasterData) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision)
|| methodName.equals(ApiGetProcessData) || methodName.equals(ApiDeleteProcess)) {
apiValue = Constant.ApiValue.checkapi;
} else if (methodName.equals(ApiGetChatPushData) || methodName.equals(ApigetChatRooms) || methodName.equals(ApigetUser) || methodName.equals(ApigetMessage)) { // pushActionはchatapiを指定
} else if (methodName.equals(ApiGetChatPushData) || methodName.equals(ApigetChatRooms) || methodName.equals(ApigetUser) || methodName.equals(ApigetMessage) || methodName.equals(ApigetFavorite)) { // pushActionはchatapiを指定
apiValue = Constant.ApiValue.chatapi;
}
......
......@@ -6,6 +6,8 @@ package jp.agentec.abook.abv.bl.common.constant;
public interface ABookCommConstants {
String TAG = "ABookComm";
//AbookComm専用の共通インターフェース
interface KEY {
String CHAT_ROOM_ID = "chatRoomId";
......@@ -25,7 +27,9 @@ public interface ABookCommConstants {
String PROFILE_URL = "profileUrl";
String GROUP_NAME = "groupName";
String GROUP_ID = "groupId";
String GROUP_IDS = "groupIds";
String GROUP_PATH_LIST = "groupPathList";
String IS_FAVORITE = "isFavorite";
String CHILD_GROUP_LIST = "childGroupList";
String GROUP_USER_LIST = "groupUserList";
String BODY = "body";
......@@ -35,7 +39,7 @@ public interface ABookCommConstants {
String ROOM_NAME = "roomName";
String ATTEND_USERS = "attendUsers";
String MEMBER_NAME = "memberName";
String DEL_FLG = "del_flg";
String DEL_FLG = "delFlg";
String ROOM_TYPE = "roomType";
String GROUP_ID_LIST = "groupIdList";
String MESSAGE_INFO_LIST = "messageInfoList";
......@@ -47,6 +51,21 @@ public interface ABookCommConstants {
String GROUP_MEMBER_LIST = "groupMemberList";
String CHAT_ROOM_INFO_LIST = "chatRoomInfoList";
String LAST_MESSAGE_INFO = "lastMessageInfo";
String FAVORITE_USER_IDS = "favoriteUserIds";
String FAVORITE_GROUP_IDS = "favoriteGroupIds";
String GROUP_INFO_LAST_UPDATE_DATE = "groupInfoLastUpdateDate";
String ROOT_GROUP_ID = "rootGroupId";
interface API_KIND {
String USER = "user";
String ROOM = "room";
String GROUP = "group";
String CHAT = "chat";
String FILE = "file";
String COLLABORATION = "collaboration";
}
}
interface FLAG {
......@@ -54,5 +73,7 @@ public interface ABookCommConstants {
Integer OFF = 0;
Integer ON = 1;
}
Integer GROUP_REQUEST_ALL = 0;
}
}
package jp.agentec.abook.abv.bl.common.util;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtil {
public String getNowByFormat(String format) {
SimpleDateFormat format1 = new SimpleDateFormat (format);
Date time = new Date();
return format1.format(time);
}
}
......@@ -81,7 +81,7 @@ public class ChatRoomDao extends AbstractDao {
sql.append(" ON cr.chat_room_id = cm.chat_room_id ");
sql.append(" WHERE cr.type =? ");
sql.append(" GROUP BY cr.chat_room_id ");
sql.append(" ORDER BY unread_count, cm.insert_date DESC ");
sql.append(" ORDER BY CASE WHEN unread_count = 0 THEN 0 ELSE 1 END DESC, cm.insert_date DESC ");
List<ChatRoomDto> list = rawQueryGetDtoList(sql.toString(), new String[]{""+ roomType}, ChatRoomDto.class);
return list;
}
......@@ -103,6 +103,7 @@ public class ChatRoomDao extends AbstractDao {
beginTransaction();
for (ChatRoomDto chatRoomDto : chatRoomDtoList) {
insertChatRoom(chatRoomDto);
insertChatRoomUsers(chatRoomDto.attendUsers, chatRoomDto.chatRoomId);
}
commit();
} catch (Exception e) {
......@@ -112,6 +113,12 @@ 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});
}
}
public boolean updateChatRoom(ChatRoomDto dto) {
long count = update("update t_chat_room set chat_room_name=?, type=?, unread_count=?, user_count=?, favorite_register_date=? where chat_room_id=?", dto.getUpdateValues());
return count > 0;
......
......@@ -90,6 +90,23 @@ public class GroupDao extends AbstractDao {
return rawQueryGetStringList(sql.toString(), null);
}
public List<String> 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_list ");
sql.append(" FROM m_group usergroup ");
sql.append(" LEFT JOIN m_group parentgroup on usergroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_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 rawQueryGetStringList(sql.toString(), new String[] { "" + shopMemberId});
}
private String generateGetGroupsQuery(QueryType queryType, int[] groupRelationids, int[] parentGroupIds, Boolean downloaded, String searchKeyword, SearchDivisionType searchDivisionType, boolean isOnlineSearched) {
StringBuffer sql = new StringBuffer();
......@@ -501,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);
}
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) {
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);
......@@ -528,7 +549,15 @@ public class GroupDao extends AbstractDao {
list = rawQueryGetDtoList("select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ parentId}, GroupDto.class);
return list;
}
public GroupDto getRootGroup() {
return rawQueryGetDto("select * from m_group mg where (mg.parent_group_id = 0)",null, GroupDto.class);
}
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);
}
public boolean isExistParent(int baseId) {
return rawQueryGetInt("select * from m_group where parent_group_id = " + baseId, null) > 0;
}
......@@ -590,8 +619,8 @@ public class GroupDao extends AbstractDao {
public void updateFavoriteGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_group ");
sql.append(" , favorite_register_date = ? ");
sql.append(" WHERE group_id = ? ");
sql.append(" SET favorite_register_date = ? ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (GroupDto groupDto : groupList) {
......
......@@ -61,10 +61,11 @@ public class ShopMemberDao extends AbstractDao {
public void insertShopMember(ShopMemberDto dto) {
try {
beginTransaction();
insert("insert or replace into m_shop_member (shop_member_id, shop_member_name, profile_url, favorite_register_date, self_flg) values (?,?,?,?,?)", dto.getInsertValues());
insert("insert or replace into m_shop_member (shop_member_id, shop_member_name, profile_url, self_flg, favorite_register_date) values (?,?,?,?,(select favorite_register_date from m_shop_member where shop_member_id = ?))", dto.getInsertValues());
update(" delete from r_shop_member_group WHERE shop_member_id = ? ", new Integer[]{dto.shopMemberId});
for (Integer groupId : dto.groupIdList) {
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[] {groupId});
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
commit();
} catch (Exception e) {
......@@ -79,10 +80,10 @@ public class ShopMemberDao extends AbstractDao {
try {
beginTransaction();
for (ShopMemberDto dto : dtoList) {
insert("insert or replace into m_shop_member (shop_member_id, shop_member_name, profile_url, favorite_register_date, self_flg) values (?,?,?,?,?)", dto.getInsertValues());
insert("insert or replace into m_shop_member (shop_member_id, shop_member_name, profile_url, self_flg, favorite_register_date) values (?,?,?,?, (select favorite_register_date from m_shop_member where shop_member_id = ?))", dto.getInsertValues());
if (dto.groupIdList == null) { continue; }
for (Integer groupId : dto.groupIdList) {
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[] {groupId});
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
}
commit();
......@@ -98,6 +99,20 @@ public class ShopMemberDao extends AbstractDao {
return rawQueryGetDto("select * from m_shop_member where self_flg = 1", null, ShopMemberDto.class);
}
public List<ShopMemberDto> getUserInRoom(Integer chatRoomId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT sm.* ");
sql.append(" FROM ");
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_chat_room_shop_member AS rrm ");
sql.append(" ON sm.shop_member_id = rrm.shop_member_id ");
sql.append(" WHERE rrm.chat_room_id =?");
sql.append(" AND sm.self_flg != 1");
sql.append(" ORDER BY sm.shop_member_name DESC ");
List<ShopMemberDto> list = rawQueryGetDtoList(sql.toString(), new String[]{""+ chatRoomId}, ShopMemberDto.class);
return list;
}
public List<ShopMemberDto> getfavoriteUserList() {
return rawQueryGetDtoList("select * from m_shop_member where favorite_register_date NOT NULL", null, ShopMemberDto.class);
}
......@@ -108,6 +123,7 @@ public class ShopMemberDao extends AbstractDao {
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 ");
......@@ -119,6 +135,43 @@ public class ShopMemberDao extends AbstractDao {
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() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
......@@ -136,8 +189,13 @@ public class ShopMemberDao extends AbstractDao {
return list;
}
public boolean updateShopMember(MemberInfoDto dto) {
long count = update("update m_shop_member set shop_member_name=?, profile_url=?, favorite_register_date=? where shop_member_id=?", dto.getUpdateValues());
public boolean updateShopMember(ShopMemberDto dto) {
long count = update("update m_shop_member set shop_member_name=?, profile_url=? where shop_member_id=?", dto.getUpdateValues());
return count > 0;
}
public boolean updateFavoriteUser(ShopMemberDto dto) {
long count = update("update m_shop_member set favorite_register_date=? where shop_member_id=?", new Object[]{dto.favoriteRegisterDate, dto.shopMemberId});
return count > 0;
}
......
package jp.agentec.abook.abv.bl.dto;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -15,6 +16,7 @@ public class ChatRoomDto extends AbstractDto {
public Integer messageType;
public String insertDate;
public ChatMessageDto lastMessageInfo;
public ArrayList<Integer> attendUsers;
@Override
public Object[] getInsertValues() {
......
......@@ -22,6 +22,7 @@ public class GroupDto extends AbstractDto {
public int delFlg;
public List<ShopMemberDto> groupMembers;
public List<String> groupPathList;
public String updateDate;
public GroupDto() {
}
......
......@@ -13,12 +13,12 @@ public class ShopMemberDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
return new Object[] { shopMemberId, shopMemberName, profileUrl, favoriteRegisterDate, selfFlg };
return new Object[] { shopMemberId, shopMemberName, profileUrl, selfFlg , shopMemberId};
}
@Override
public Object[] getUpdateValues() {
return new Object[] { shopMemberName, profileUrl, favoriteRegisterDate, shopMemberId };
return new Object[] { shopMemberName, profileUrl, shopMemberId };
}
@Override
......
......@@ -4,6 +4,7 @@ import java.lang.reflect.Method;
import java.net.URLEncoder;
import java.util.Map;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.ABVRuntimeException;
import jp.agentec.adf.core.ADFObject;
import jp.agentec.adf.core.formatter.PropertyNameFormatter;
......@@ -68,12 +69,11 @@ public abstract class HttpParameterObject extends ADFObject {
Object value = method.invoke(this);
if (value != null) {
if (propertyName.equals("groupIds")) {
sb.append(value);
if (propertyName.equals(ABookCommConstants.KEY.GROUP_IDS)) {
sb.append(value.toString());
} else {
sb.append(URLEncoder.encode(value.toString(), encoding).replace("+", "%20"));
}
}
sb.append(DelimiterKeyKey);
......
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