Commit 68b7cad4 by Lee Munkyeong

アーカイブ実装

parent e7e39533
......@@ -43,9 +43,9 @@ public class ArchiveListJSON extends AcmsCommonJSON {
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.TIME)
.getLong(ABookCommConstants.KEY.TIME));
archiveDto.delFlg = archiveJSON.getInt(ABookCommConstants.KEY.ARCHIVE_ID);
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);
archiveList.add(archiveDto);
......
......@@ -59,16 +59,54 @@ public class ArchiveDao extends AbstractDao {
return list;
}
public List<ArchiveDto> getAllArchive() {
List<ArchiveDto> list = rawQueryGetDtoList("select * from t_archive ", null, ArchiveDto.class);
return list;
}
public void insertArchive(ArchiveDto dto) {
insert("insert or replace into t_archive (archive_id, archive_name, archive_date, archive_type, room_id, save_user_id, attend_user_ids) 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=?, room_id=?, collaboration_id=?, shop_member_id=?, archive_save_path=? where archive_id=?", dto.getUpdateValues());
return count > 0;
}
public void deleteArchive() {
public void deleteArchive(ArchiveDto archiveDto) {
delete("t_archive", "archive_id=?", archiveDto.getKeyValues());
}
public void deleteArchiveAllData() {
try {
beginTransaction();
delete("t_archive", null, null);
......
......@@ -22,7 +22,7 @@ public class TArchive extends SQLiteTableScript {
sql.append(" , archive_date VARCHAR2(64) ");
sql.append(" , attend_user_ids VARCHAR2 ");
sql.append(" , room_id INTEGER ");
sql.append(" , save_user_id INTEGER NOT NULL ");
sql.append(" , save_user_id INTEGER ");
sql.append(" , PRIMARY KEY (archive_id)");
sql.append(" ) ");
......
......@@ -668,8 +668,8 @@ public class CommunicationLogic extends AbstractLogic {
deleteList.add(archiveDto);
}
}
archiveDao.insertArchiveList();
archiveDao.deleteArchiveList();
archiveDao.insertArchiveList(insertList);
archiveDao.deleteArchiveList(deleteList);
}
public void updateGroup(List<ChatGroupDto> GroupList) {
......@@ -776,4 +776,19 @@ 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();
}
}
......@@ -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;
}
}
......@@ -1038,6 +1038,13 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
editor.commit();
}
@JavascriptInterface
public String getArchiveList() {
String archiveListStr = communicationLogic.getAllArchive();
return archiveListStr;
}
}
/**
......
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