Commit 13ffbb78 by Lee Munkyeong

未読数追加。

parent 4146f156
...@@ -48,6 +48,8 @@ public class MessageInfoListJSON extends AcmsCommonJSON { ...@@ -48,6 +48,8 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
chatMessageDto.chatMessageId = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_ID); chatMessageDto.chatMessageId = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_ID);
chatMessageDto.message = messageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE); chatMessageDto.message = messageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
chatMessageDto.messageType = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_TYPE); chatMessageDto.messageType = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_TYPE);
chatMessageDto.unreadCount = messageInfoJSON.getInt(ABookCommConstants.KEY.UNREAD_COUNT);
if (messageInfoJSON.has(ABookCommConstants.KEY.TIME)) { if (messageInfoJSON.has(ABookCommConstants.KEY.TIME)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(messageInfoJSON.getJSONObject(ABookCommConstants.KEY.TIME).getLong(ABookCommConstants.KEY.TIME)); chatMessageDto.insertDate = DateTimeUtil.millToDateString(messageInfoJSON.getJSONObject(ABookCommConstants.KEY.TIME).getLong(ABookCommConstants.KEY.TIME));
} }
......
...@@ -72,6 +72,10 @@ public class ChatMessageDao extends AbstractDao { ...@@ -72,6 +72,10 @@ public class ChatMessageDao extends AbstractDao {
if (column != -1) { if (column != -1) {
dto.selfFlg = cursor.getInt(column); dto.selfFlg = cursor.getInt(column);
} }
column = cursor.getColumnIndex("unread_count");
if (column != -1) {
dto.unreadCount = cursor.getInt(column);
}
return dto; return dto;
} }
...@@ -90,6 +94,7 @@ public class ChatMessageDao extends AbstractDao { ...@@ -90,6 +94,7 @@ public class ChatMessageDao extends AbstractDao {
sql.append(" ,sm.shop_member_name "); sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url "); sql.append(" ,sm.profile_url ");
sql.append(" ,sm.self_flg "); sql.append(" ,sm.self_flg ");
sql.append(" ,cm.unread_count ");
sql.append(" FROM "); sql.append(" FROM ");
sql.append(" t_chat_message AS cm "); sql.append(" t_chat_message AS cm ");
sql.append(" INNER JOIN "); sql.append(" INNER JOIN ");
...@@ -116,6 +121,7 @@ public class ChatMessageDao extends AbstractDao { ...@@ -116,6 +121,7 @@ public class ChatMessageDao extends AbstractDao {
sql.append(" ,sm.shop_member_name "); sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url "); sql.append(" ,sm.profile_url ");
sql.append(" ,sm.self_flg "); sql.append(" ,sm.self_flg ");
sql.append(" ,cm.unread_count ");
sql.append(" FROM "); sql.append(" FROM ");
sql.append(" t_chat_message AS cm "); sql.append(" t_chat_message AS cm ");
sql.append(" INNER JOIN "); sql.append(" INNER JOIN ");
...@@ -143,7 +149,7 @@ public class ChatMessageDao extends AbstractDao { ...@@ -143,7 +149,7 @@ public class ChatMessageDao extends AbstractDao {
} }
public void insertChatMessage(ChatMessageDto dto) { public void insertChatMessage(ChatMessageDto dto) {
insert("insert or replace into t_chat_message (chat_message_id, chat_room_id, shop_member_id, message, message_type, image_name, download_file_name, save_path, insert_date) values (?,?,?,?,?,?,?,?,?)", dto.getInsertValues()); insert("insert or replace into t_chat_message (chat_message_id, chat_room_id, shop_member_id, message, message_type, image_name, download_file_name, save_path, insert_date, unread_count) values (?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
} }
public void insertChatMessage(List<ChatMessageDto> chatMessageDtoList) { public void insertChatMessage(List<ChatMessageDto> chatMessageDtoList) {
...@@ -161,7 +167,7 @@ public class ChatMessageDao extends AbstractDao { ...@@ -161,7 +167,7 @@ public class ChatMessageDao extends AbstractDao {
} }
public boolean updateChatMessage(ChatMessageDto dto) { public boolean updateChatMessage(ChatMessageDto dto) {
long count = update("update t_chat_message set chat_room_id=?, shop_member_id=?, message=?, message_type=?, image_name=?, download_file_name=?, save_path=?, insert_date=? where chat_message_id=?", dto.getUpdateValues()); long count = update("update t_chat_message set chat_room_id=?, shop_member_id=?, message=?, message_type=?, image_name=?, download_file_name=?, save_path=?, insert_date=?, unread_count where chat_message_id=?", dto.getUpdateValues());
return count > 0; return count > 0;
} }
......
...@@ -22,6 +22,7 @@ public class TChatMessage extends SQLiteTableScript { ...@@ -22,6 +22,7 @@ public class TChatMessage extends SQLiteTableScript {
sql.append(" , message VARCHAR2 "); sql.append(" , message VARCHAR2 ");
sql.append(" , message_type INTEGER "); sql.append(" , message_type INTEGER ");
sql.append(" , image_name VARCHAR2 "); sql.append(" , image_name VARCHAR2 ");
sql.append(" , unread_count INTEGER ");
sql.append(" , download_file_name VARCHAR2 "); sql.append(" , download_file_name VARCHAR2 ");
sql.append(" , save_path VARCHAR2 "); sql.append(" , save_path VARCHAR2 ");
sql.append(" , insert_date VARCHAR2(64)"); sql.append(" , insert_date VARCHAR2(64)");
......
package jp.agentec.abook.abv.bl.dto; package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class ChatMessageDto extends AbstractDto { public class ChatMessageDto extends AbstractDto {
public Integer chatMessageId; public Integer chatMessageId;
public Integer chatRoomId; public Integer chatRoomId;
...@@ -15,15 +13,16 @@ public class ChatMessageDto extends AbstractDto { ...@@ -15,15 +13,16 @@ public class ChatMessageDto extends AbstractDto {
public String shopMemberName; public String shopMemberName;
public String profileUrl; public String profileUrl;
public Integer selfFlg; public Integer selfFlg;
public Integer unreadCount;
@Override @Override
public Object[] getInsertValues() { public Object[] getInsertValues() {
return new Object[] { chatMessageId, chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate }; return new Object[] { chatMessageId, chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate, unreadCount };
} }
@Override @Override
public Object[] getUpdateValues() { public Object[] getUpdateValues() {
return new Object[] { chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate, chatMessageId }; return new Object[] { chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate, unreadCount, chatMessageId };
} }
@Override @Override
......
...@@ -116,6 +116,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -116,6 +116,7 @@ public class CommunicationLogic extends AbstractLogic {
chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate); chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate);
chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, chatMessageDto.profileUrl); chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, chatMessageDto.profileUrl);
chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg); chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg);
chatMessageMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatMessageDto.unreadCount);
JSONObject jsonObject = new JSONObject(chatMessageMap); JSONObject jsonObject = new JSONObject(chatMessageMap);
resultJsonArray.put(jsonObject); resultJsonArray.put(jsonObject);
} }
...@@ -138,6 +139,7 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -138,6 +139,7 @@ public class CommunicationLogic extends AbstractLogic {
chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate); chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate);
chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, chatMessageDto.profileUrl); chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, chatMessageDto.profileUrl);
chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg); chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg);
chatMessageMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatMessageDto.unreadCount);
JSONObject jsonObject = new JSONObject(chatMessageMap); JSONObject jsonObject = new JSONObject(chatMessageMap);
resultJsonArray.put(jsonObject); resultJsonArray.put(jsonObject);
} }
......
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