Commit 43e99294 by Lee Munkyeong

Merge branch 'features/abcomm_sp6_archive' into 'features/abcomm_sp6'

Features/abcomm sp6 archive

See merge request !104
parents 5379e727 049c73aa
......@@ -16,6 +16,8 @@ import jp.agentec.abook.abv.bl.acms.client.json.AcmsCommonJSON;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ApertureMasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.AppLatestVersionJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ArchiveDetailJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ArchiveListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.AuthLevelJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CategoriesJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ChangeRoomNameJSON;
......@@ -48,6 +50,8 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AddMemberGroupParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AppStoreNewLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ArchiveDetailRequestParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ArchiveRequestParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ChangeRoomNameParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.CheckSendLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ContentReadingLogParameters;
......@@ -749,6 +753,36 @@ public class AcmsClient implements AcmsClientResponseListener {
}
/**
* アーカイブ取得
*
* @param sid
* @param updateDate
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ArchiveListJSON getArchives(String sid, String updateDate) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetArchive, new ArchiveRequestParameters(sid, AcmsApis.ArchiveCmds.getArchive, updateDate));
ArchiveListJSON json = new ArchiveListJSON(response.httpResponseBody);
return json;
}
/**
* アーカイブ詳細取得
*
* @param sid
* @param archiveId
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ArchiveDetailJSON getArchiveDetail(String sid, Integer archiveId, Integer collaborationDetailId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetArchive, new ArchiveDetailRequestParameters(sid, AcmsApis.ArchiveCmds.getArchiveDetail, archiveId, collaborationDetailId));
ArchiveDetailJSON json = new ArchiveDetailJSON(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 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.ArchiveDto;
import jp.agentec.adf.util.DateTimeUtil;
public class ArchiveDetailJSON extends AcmsCommonJSON {
public ArchiveDto archiveDto;
public ArchiveDetailJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
if (!json.getJSONObject(ABookCommConstants.KEY.BODY).has(ABookCommConstants.KEY.ARCHIVE_INFO)) { return; }
JSONObject archiveInfo = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONObject(ABookCommConstants.KEY.ARCHIVE_INFO);
archiveDto = new ArchiveDto();
archiveDto.archiveId = archiveInfo.getInt(ABookCommConstants.KEY.ARCHIVE_ID);
archiveDto.archiveName = archiveInfo.getString(ABookCommConstants.KEY.ARCHIVE_NAME);
archiveDto.archiveType = archiveInfo.getInt(ABookCommConstants.KEY.ARCHIVE_TYPE);
archiveDto.archiveDate = DateTimeUtil.millToDateString(archiveInfo.getJSONObject(ABookCommConstants.KEY.ARCHIVE_DATE)
.getLong(ABookCommConstants.KEY.TIME), "yyyy/MM/dd HH:mm");
archiveDto.roomId = archiveInfo.getInt(ABookCommConstants.KEY.ROOM_ID);
archiveDto.saveUserId = archiveInfo.getInt(ABookCommConstants.KEY.SAVE_USER_ID);
archiveDto.filePath = archiveInfo.getString(ABookCommConstants.KEY.FILE_PATH);
if (archiveInfo.has(ABookCommConstants.KEY.ATTEND_USER_IDS)) {
archiveDto.attendUserIds = archiveInfo.getJSONArray(ABookCommConstants.KEY.ATTEND_USER_IDS).toString();
}
}
}
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.ArchiveDto;
import jp.agentec.abook.abv.bl.dto.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.DateTimeUtil;
public class ArchiveListJSON extends AcmsCommonJSON {
public ArrayList<ArchiveDto> archiveList;
public String archiveLastUpdateDate;
public ArchiveListJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得
if (!json.has(ABookCommConstants.KEY.BODY)) { return; }
if (!json.getJSONObject(ABookCommConstants.KEY.BODY).has(ABookCommConstants.KEY.ARCHIVE_INFO_LIST)) { return; }
JSONArray archiveListJsonArray = json.getJSONObject(ABookCommConstants.KEY.BODY).getJSONArray(ABookCommConstants.KEY.ARCHIVE_INFO_LIST);
if (archiveListJsonArray == null) { return; }
archiveList = new ArrayList<ArchiveDto>();
for (int listCount = 0; listCount < archiveListJsonArray.length(); listCount++) {
if (archiveListJsonArray.getJSONObject(listCount).length() == 0) {
break;
}
JSONObject archiveJSON = archiveListJsonArray.getJSONObject(listCount);
ArchiveDto archiveDto = new ArchiveDto();
archiveDto.archiveId = archiveJSON.getInt(ABookCommConstants.KEY.ARCHIVE_ID);
archiveDto.archiveName = archiveJSON.getString(ABookCommConstants.KEY.ARCHIVE_NAME);
archiveDto.archiveType = archiveJSON.getInt(ABookCommConstants.KEY.ARCHIVE_TYPE);
archiveDto.archiveDate = DateTimeUtil.millToDateString(archiveJSON.getJSONObject(ABookCommConstants.KEY.ARCHIVE_DATE)
.getLong(ABookCommConstants.KEY.TIME), "yyyy/MM/dd HH:mm");
archiveDto.delFlg = archiveJSON.getInt(ABookCommConstants.KEY.DEL_FLG);
archiveDto.collaborationDetailId = archiveJSON.getInt(ABookCommConstants.KEY.COLLABORATION_DEATAIL_ID);
archiveList.add(archiveDto);
}
if (json.getJSONObject(ABookCommConstants.KEY.BODY).has(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE)) {
archiveLastUpdateDate = json.getJSONObject(ABookCommConstants.KEY.BODY).getString(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE);
}
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link ArchiveDetailRequestParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author lee-mk
* @version 1.0.0
*/
public class ArchiveDetailRequestParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private Integer archiveId;
private Integer collaborationDetailId;
/**
* {@link ArchiveDetailRequestParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public ArchiveDetailRequestParameters(String sid, String cmd, Integer archiveId, Integer collaborationDetailId) {
this.sid = sid;
this.cmd = cmd;
this.archiveId = archiveId;
this.collaborationDetailId = collaborationDetailId;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
/**
* archiveIdを返します。
* @return 詳細取得対象のIDです。
* @since 1.0.0
*/
public Integer getArchiveId() {
return archiveId;
}
/**
* collaborationDetailIdを返します。
* @return collaborationDetailId
* @since 1.0.0
*/
public Integer getCollaborationDetailId() {
return collaborationDetailId;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link ArchiveRequestParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author Lee-mk
* @version 1.0.0
*/
public class ArchiveRequestParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private String updatedDate;
/**
* {@link ArchiveRequestParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param cmd Apiリクエストに必要なコマンド(ABOOK COMM専用)。
* @since 1.0.0
*/
public ArchiveRequestParameters(String sid, String cmd, String updatedDate) {
this.sid = sid;
this.cmd = cmd;
this.updatedDate = updatedDate;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* コマンドを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
public String getUpdatedDate() {
return updatedDate;
}
}
......@@ -174,6 +174,7 @@ public class AcmsApis {
public static final String ApigetUser = "user";
public static final String ApigetMessage = "message";
public static final String ApigetFavorite = "favorite";
public static final String ApigetArchive = "archive";
public static final class UserCmds {
public static final String inviteUsers = "3";
......@@ -201,6 +202,11 @@ public class AcmsApis {
public static final String removeFavoriteGroup = "8";
}
public static final class ArchiveCmds {
public static final String getArchive = "1";
public static final String getArchiveDetail = "2";
}
// download
/**
* コンテンツのZIPファイルを取得<br>
......@@ -247,7 +253,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) || methodName.equals(ApigetFavorite)) { // pushActionはchatapiを指定
} else if (methodName.equals(ApiGetChatPushData) || methodName.equals(ApigetChatRooms) || methodName.equals(ApigetUser) || methodName.equals(ApigetMessage) || methodName.equals(ApigetFavorite) || methodName.equals(ApigetArchive)) { // pushActionはchatapiを指定
apiValue = Constant.ApiValue.chatapi;
}
......
......@@ -57,6 +57,18 @@ public interface ABookCommConstants {
String FAVORITE_GROUP_IDS = "favoriteGroupIds";
String GROUP_INFO_LAST_UPDATE_DATE = "groupInfoLastUpdateDate";
String ARCHIVE_INFO_LIST = "archiveInfoList";
String ARCHIVE_INFO = "archiveInfo";
String ARCHIVE_ID = "archiveId";
String ARCHIVE_NAME = "archiveName";
String ARCHIVE_DATE = "archiveDate";
String ARCHIVE_TYPE = "archiveType";
String SAVE_USER_ID = "saveUserId";
String FILE_PATH = "filePath";
String ATTEND_USER_IDS = "attendUserIds";
String ARCHIVE_INFO_LAST_UPDATE_DATE = "archiveInfoLastUpdateDate";
String COLLABORATION_DEATAIL_ID = "collaborationDetailId";
String ROOT_GROUP_ID = "rootGroupId";
String HTTP_STATUS = "httpStatus";
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
......@@ -7,6 +8,8 @@ import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ArchiveDto;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.CollaborationDto;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.StringUtil;
public class ArchiveDao extends AbstractDao {
......@@ -31,45 +34,139 @@ public class ArchiveDao extends AbstractDao {
if (column != -1) {
dto.archiveName = cursor.getString(column);
}
column = cursor.getColumnIndex("archive_date");
if (column != -1) {
dto.archiveDate = cursor.getString(column);
}
column = cursor.getColumnIndex("archive_type");
if (column != -1) {
dto.archiveType = cursor.getInt(column);
}
column = cursor.getColumnIndex("archive_url");
column = cursor.getColumnIndex("room_id");
if (column != -1) {
dto.archiveUrl = cursor.getString(column);
dto.roomId = cursor.getInt(column);
}
column = cursor.getColumnIndex("collaboration_id");
column = cursor.getColumnIndex("save_user_id");
if (column != -1) {
dto.collaborationId = cursor.getInt(column);
dto.saveUserId = cursor.getInt(column);
}
column = cursor.getColumnIndex("shop_member_id");
column = cursor.getColumnIndex("attend_user_ids");
if (column != -1) {
dto.shopMemberId = cursor.getInt(column);
dto.attendUserIds = cursor.getString(column);
}
column = cursor.getColumnIndex("archive_save_path");
column = cursor.getColumnIndex("collaboration_detail_id");
if (column != -1) {
dto.archiveSavePath = cursor.getString(column);
dto.collaborationDetailId = cursor.getInt(column);
}
column = cursor.getColumnIndex("file_path");
if (column != -1) {
dto.filePath = cursor.getString(column);
}
return dto;
}
public List<ArchiveDto> getArchive(int archiveId) {
List<ArchiveDto> list = rawQueryGetDtoList("select * from t_archive where archive_id = ?", new String[]{""+ archiveId}, ArchiveDto.class);
public ArchiveDto getArchive(int archiveId) {
ArchiveDto list = rawQueryGetDto("select * from t_archive where archive_id = ?", new String[]{""+ archiveId}, ArchiveDto.class);
return list;
}
public List<ArchiveDto> getAllArchive() {
List<ArchiveDto> list = rawQueryGetDtoList("select * from t_archive ", null, ArchiveDto.class);
return list;
}
public List<Integer> getExistArchiveIds() {
List<Integer> list = rawQueryGetIntegerList("select archive_id from t_archive ", null);
return list;
}
public List<ArchiveDto> getArchiveListByName(String[] keywords) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT archive_id");
sql.append(" ,archive_name");
sql.append(" ,archive_date");
sql.append(" ,archive_type");
sql.append(" ,room_id");
sql.append(" ,save_user_id");
sql.append(" ,attend_user_ids");
sql.append(" FROM t_archive ");
ArrayList<String> whereSqlList = new ArrayList<String>();
for (String keyword : keywords) {
if(StringUtil.isNullOrEmpty(keyword)){
continue;
}
String whereSql = "archive_name LIKE '%"+keyword+"%'";
whereSqlList.add(whereSql);
}
if (CollectionUtil.isNotEmpty(whereSqlList)) {
sql.append("WHERE " + StringUtil.join(" AND ", whereSqlList));
}
List<ArchiveDto> list = rawQueryGetDtoList(sql.toString(), null, ArchiveDto.class);
return list;
}
public void insertArchive(ArchiveDto dto) {
insert("insert into t_archive (archive_id, archive_name, archive_type, archive_url, collaboration_id, shop_member_id, archive_save_path) values (?,?)", dto.getInsertValues());
insert("insert or ignore into t_archive (archive_id, archive_name, archive_date, archive_type, room_id, save_user_id, attend_user_ids, collaboration_detail_id, file_path) values (?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
}
public void insertArchiveList(List<ArchiveDto> archiveDtoList) {
try {
beginTransaction();
for (ArchiveDto archiveDto : archiveDtoList) {
insertArchive(archiveDto);
}
commit();
} catch (Exception e) {
rollback();
Logger.e("insertArchive failed.", e);
throw new RuntimeException(e);
}
}
public void deleteArchiveList(List<ArchiveDto> archiveDtoList) {
try {
beginTransaction();
for (ArchiveDto archiveDto : archiveDtoList) {
deleteArchive(archiveDto);
}
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteArchive failed.", e);
throw new RuntimeException(e);
}
}
public boolean updateArchive(ArchiveDto dto) {
long count = update("update t_archive set archive_name=?, archive_type=?, archive_url=?, collaboration_id=?, shop_member_id=?, archive_save_path=? where archive_id=?", dto.getUpdateValues());
long count = update("update t_archive set archive_name=?, archive_type=?, archive_date=?, collaboration_detail_id=? where archive_id=?", dto.getUpdateValues());
return count > 0;
}
public void deleteArchive() {
public void updateArchiveInfoList(List<ArchiveDto> archiveDtoList) {
try {
beginTransaction();
for (ArchiveDto archiveDto : archiveDtoList) {
updateArchive(archiveDto);
}
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteArchive failed.", e);
throw new RuntimeException(e);
}
}
public boolean updateArchiveDetailInfo(ArchiveDto dto) {
long count = update("update t_archive set archive_name=?, archive_type=?, archive_date=?, room_id=?, attend_user_ids=?, file_path=?, save_user_id=? where archive_id=?", dto.getUpdateDetailValues());
return count > 0;
}
public void deleteArchive(ArchiveDto archiveDto) {
delete("t_archive", "archive_id=?", archiveDto.getKeyValues());
}
public void deleteArchiveAllData() {
try {
beginTransaction();
delete("t_archive", null, null);
......
......@@ -17,12 +17,14 @@ public class TArchive extends SQLiteTableScript {
sql.append(" create table t_archive ( ");
sql.append(" archive_id INTEGER NOT NULL ");
sql.append(" , archive_name VARCHAR2(64) ");
sql.append(" , archive_name VARCHAR2 ");
sql.append(" , archive_type INTEGER NOT NULL ");
sql.append(" , archive_url VARCHAR2 ");
sql.append(" , collaboration_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , archive_save_path VARCHAR2 ");
sql.append(" , archive_date VARCHAR2(64) ");
sql.append(" , attend_user_ids VARCHAR2 ");
sql.append(" , file_path VARCHAR2 ");
sql.append(" , room_id INTEGER ");
sql.append(" , save_user_id INTEGER ");
sql.append(" , collaboration_detail_id INTEGER ");
sql.append(" , PRIMARY KEY (archive_id)");
sql.append(" ) ");
......
......@@ -4,21 +4,28 @@ public class ArchiveDto extends AbstractDto {
public Integer archiveId;
public String archiveName;
public String archiveDate;
public Integer archiveType;
public String archiveUrl;
public Integer collaborationId;
public Integer shopMemberId;
public String archiveSavePath;
public Integer roomId;
public Integer saveUserId;
public String attendUserIds;
public String filePath;
public Integer collaborationDetailId;
public Integer delFlg = 0;
@Override
public Object[] getInsertValues() {
return new Object[]{archiveId, archiveName, archiveType, archiveUrl, collaborationId, shopMemberId, archiveSavePath};
return new Object[]{archiveId, archiveName, archiveDate, archiveType, roomId, saveUserId, attendUserIds, collaborationDetailId, filePath};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{archiveName, archiveType, archiveUrl, collaborationId, shopMemberId,archiveSavePath, archiveId};
return new Object[]{archiveName, archiveType, archiveDate, collaborationDetailId, archiveId};
}
public Object[] getUpdateDetailValues() {
return new Object[]{archiveName, archiveType, archiveDate, roomId, attendUserIds, filePath, saveUserId, archiveId};
}
@Override
......
......@@ -11,11 +11,14 @@ import java.util.Map;
import java.util.stream.Collectors;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ArchiveDao;
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.ShopMemberDao;
import jp.agentec.abook.abv.bl.dto.ArchiveDto;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.ChatGroupDto;
......@@ -35,6 +38,7 @@ public class CommunicationLogic extends AbstractLogic {
private ChatMessageDao chatMessageDao = AbstractDao.getDao(ChatMessageDao.class);
private ShopMemberDao shopMemberDao = AbstractDao.getDao(ShopMemberDao.class);
private ChatGroupDao chatGroupDao = AbstractDao.getDao(ChatGroupDao.class);
private ArchiveDao archiveDao = AbstractDao.getDao(ArchiveDao.class);
/**
* {@link CommunicationLogic} クラスのインスタンスを初期化します。
......@@ -656,6 +660,32 @@ public class CommunicationLogic extends AbstractLogic {
//shopMemberDao.deleteShopMemberByList(deleteList);
}
public void updateArchives(List<ArchiveDto> archiveDtoList) {
List<ArchiveDto> insertList = new ArrayList<ArchiveDto>();
List<ArchiveDto> deleteList = new ArrayList<ArchiveDto>();
List<ArchiveDto> updateList = new ArrayList<ArchiveDto>();
List<Integer> existIdList = archiveDao.getExistArchiveIds();
for (ArchiveDto archiveDto : archiveDtoList) {
if (archiveDto.delFlg == 1) {
deleteList.add(archiveDto);
} else {
if (existIdList.contains(archiveDto.archiveId)) {
updateList.add(archiveDto);
} else {
insertList.add(archiveDto);
}
}
}
archiveDao.insertArchiveList(insertList);
archiveDao.updateArchiveInfoList(updateList);
archiveDao.deleteArchiveList(deleteList);
}
public void updateArchiveDetial(ArchiveDto archiveDto) {
archiveDao.updateArchiveDetailInfo(archiveDto);
}
public void updateGroup(List<ChatGroupDto> GroupList) {
List<ChatGroupDto> existGroupList = chatGroupDao.getAllGroups();
......@@ -760,4 +790,65 @@ public class CommunicationLogic extends AbstractLogic {
}
return attendUsers.toString();
};
public String getAllArchive() {
List<ArchiveDto> archiveList = archiveDao.getAllArchive();
JSONArray archiveArray = new JSONArray();
for (ArchiveDto archive : archiveList) {
Map<String, Object> userMap = new HashMap<String, Object>();
userMap.put(ABookCommConstants.KEY.ARCHIVE_ID, archive.archiveId);
userMap.put(ABookCommConstants.KEY.ARCHIVE_NAME, archive.archiveName);
userMap.put(ABookCommConstants.KEY.ARCHIVE_DATE, archive.archiveDate);
userMap.put(ABookCommConstants.KEY.ARCHIVE_TYPE, archive.archiveType);
JSONObject jsonObject = new JSONObject(userMap);
archiveArray.put(jsonObject);
}
return archiveArray.toString();
}
public String getArchiveListByName(String keywods) {
String[] replacedKeyword = keywods.replaceAll(" ", " ").split(" ");
List<ArchiveDto> archiveList = archiveDao.getArchiveListByName(replacedKeyword);
JSONArray archiveArray = new JSONArray();
for (ArchiveDto archive : archiveList) {
Map<String, Object> archiveMap = new HashMap<String, Object>();
archiveMap.put(ABookCommConstants.KEY.ARCHIVE_ID, archive.archiveId);
archiveMap.put(ABookCommConstants.KEY.ARCHIVE_NAME, archive.archiveName);
archiveMap.put(ABookCommConstants.KEY.ARCHIVE_DATE, archive.archiveDate);
archiveMap.put(ABookCommConstants.KEY.ARCHIVE_TYPE, archive.archiveType);
JSONObject jsonObject = new JSONObject(archiveMap);
archiveArray.put(jsonObject);
}
return archiveArray.toString();
}
public String getArchiveDetail(Integer archiveId) {
ArchiveDto archiveDto = archiveDao.getArchive(archiveId);
Map<String, Object> archiveMap = new HashMap<String, Object>();
archiveMap.put(ABookCommConstants.KEY.ARCHIVE_ID, archiveDto.archiveId);
archiveMap.put(ABookCommConstants.KEY.ARCHIVE_NAME, archiveDto.archiveName);
archiveMap.put(ABookCommConstants.KEY.ARCHIVE_DATE, archiveDto.archiveDate);
archiveMap.put(ABookCommConstants.KEY.ARCHIVE_TYPE, archiveDto.archiveType);
archiveMap.put(ABookCommConstants.KEY.ROOM_ID, archiveDto.roomId);
archiveMap.put(ABookCommConstants.KEY.ROOM_NAME, chatRoomDao.getChatRoom(archiveDto.roomId).chatRoomName);
archiveMap.put(ABookCommConstants.KEY.SAVE_USER_ID, archiveDto.saveUserId);
archiveMap.put(ABookCommConstants.KEY.ATTEND_USER_IDS, archiveDto.attendUserIds);
archiveMap.put(ABookCommConstants.KEY.FILE_PATH, archiveDto.filePath);
JSONObject jsonObject = new JSONObject(archiveMap);
return jsonObject.toString();
}
public ArchiveDto getArchive(Integer archiveId) {
return archiveDao.getArchive(archiveId);
}
public String getUserInfo(Integer shopMemberId) {
ShopMemberDto shopMemberDto = shopMemberDao.getShopMember(shopMemberId);
Map<String, Object> userMap = new HashMap<String, Object>();
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, shopMemberDto.shopMemberId);
userMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, shopMemberDto.shopMemberName);
userMap.put(ABookCommConstants.KEY.PROFILE_URL, shopMemberDto.profileUrl);
JSONObject jsonObject = new JSONObject(userMap);
return jsonObject.toString();
}
}
......@@ -593,4 +593,11 @@ public class DateTimeUtil {
return timeInFormat;
}
public static String millToDateString(long mills, String format) {
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
Date timeInDate = new Date(mills);
String timeInFormat = dateFormat.format(timeInDate);
return timeInFormat;
}
}
......@@ -39,6 +39,8 @@ import java.util.Map;
import java.util.Objects;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.ArchiveDetailJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ArchiveListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ChangeRoomNameJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteGroupJSON;
......@@ -54,6 +56,7 @@ 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.ArchiveDto;
import jp.agentec.abook.abv.bl.dto.ChatGroupDto;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
......@@ -1035,6 +1038,54 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
public void updateFavorite() throws NetworkDisconnectedException, AcmsException {
updateFavoriteInfo();
}
@JavascriptInterface
public void updateArchiveList() throws NetworkDisconnectedException, AcmsException {
SharedPreferences pref = getSharedPreferences(ABookCommConstants.TAG, MODE_PRIVATE);
String updateDate = pref.getString(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE, DEFAULT_CHECKSUM);
ArchiveListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getArchives(sid, updateDate);
communicationLogic.updateArchives(resultJson.archiveList);
if (StringUtil.isNullOrEmpty(resultJson.archiveLastUpdateDate)) { return; }
SharedPreferences.Editor editor = pref.edit();
editor.putString(ABookCommConstants.KEY.ARCHIVE_INFO_LAST_UPDATE_DATE, resultJson.archiveLastUpdateDate);
editor.commit();
}
@JavascriptInterface
public String getArchiveList() {
String archiveListStr = communicationLogic.getAllArchive();
return archiveListStr;
}
@JavascriptInterface
public String getArchiveListByName(String keyword) {
String archiveListStr = communicationLogic.getArchiveListByName(keyword);
return archiveListStr;
}
@JavascriptInterface
public String getUserInfo(String shopMemberId) {
String archiveListStr = communicationLogic.getUserInfo(Integer.parseInt(shopMemberId));
return archiveListStr;
}
@JavascriptInterface
public String getArchiveDetail(String archiveId) {
String archiveListStr = communicationLogic.getArchiveDetail(Integer.parseInt(archiveId));
return archiveListStr;
}
@JavascriptInterface
public void updateArchiveDetail(String archiveId) throws NetworkDisconnectedException, AcmsException {
ArchiveDto archiveDto = communicationLogic.getArchive(Integer.parseInt(archiveId));
ArchiveDetailJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getArchiveDetail(sid, Integer.parseInt(archiveId), archiveDto.collaborationDetailId);
if (resultJson.archiveDto == null) {
return;
}
communicationLogic.updateArchiveDetial(resultJson.archiveDto);
}
}
/**
......@@ -1102,7 +1153,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private void updateGroupInfoFromServer(String groupIds) throws NetworkDisconnectedException, AcmsException {
ArrayList<String> checkSumList = new ArrayList<String>();
SharedPreferences pref = getSharedPreferences(ABookCommConstants.TAG,MODE_PRIVATE);
SharedPreferences pref = getSharedPreferences(ABookCommConstants.TAG, MODE_PRIVATE);
for (String groupId : groupIds.split(",")) {
//checkSumList.add(pref.getString(groupId,DEFAULT_CHECKSUM));
......
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