Commit 5379e727 by Lee Munkyeong

Merge branch 'features/#477_未読数追加。' into 'features/abcomm_sp6'

未読数追加。

See merge request !103
parents 23f72ea8 13ffbb78
......@@ -48,6 +48,8 @@ public class MessageInfoListJSON extends AcmsCommonJSON {
chatMessageDto.chatMessageId = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_ID);
chatMessageDto.message = messageInfoJSON.getString(ABookCommConstants.KEY.MESSAGE);
chatMessageDto.messageType = messageInfoJSON.getInt(ABookCommConstants.KEY.MESSAGE_TYPE);
chatMessageDto.unreadCount = messageInfoJSON.getInt(ABookCommConstants.KEY.UNREAD_COUNT);
if (messageInfoJSON.has(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 {
if (column != -1) {
dto.selfFlg = cursor.getInt(column);
}
column = cursor.getColumnIndex("unread_count");
if (column != -1) {
dto.unreadCount = cursor.getInt(column);
}
return dto;
}
......@@ -90,6 +94,7 @@ public class ChatMessageDao extends AbstractDao {
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url ");
sql.append(" ,sm.self_flg ");
sql.append(" ,cm.unread_count ");
sql.append(" FROM ");
sql.append(" t_chat_message AS cm ");
sql.append(" INNER JOIN ");
......@@ -116,6 +121,7 @@ public class ChatMessageDao extends AbstractDao {
sql.append(" ,sm.shop_member_name ");
sql.append(" ,sm.profile_url ");
sql.append(" ,sm.self_flg ");
sql.append(" ,cm.unread_count ");
sql.append(" FROM ");
sql.append(" t_chat_message AS cm ");
sql.append(" INNER JOIN ");
......@@ -143,7 +149,7 @@ public class ChatMessageDao extends AbstractDao {
}
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) {
......@@ -161,7 +167,7 @@ public class ChatMessageDao extends AbstractDao {
}
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;
}
......
......@@ -22,6 +22,7 @@ public class TChatMessage extends SQLiteTableScript {
sql.append(" , message VARCHAR2 ");
sql.append(" , message_type INTEGER ");
sql.append(" , image_name VARCHAR2 ");
sql.append(" , unread_count INTEGER ");
sql.append(" , download_file_name VARCHAR2 ");
sql.append(" , save_path VARCHAR2 ");
sql.append(" , insert_date VARCHAR2(64)");
......
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class ChatMessageDto extends AbstractDto {
public Integer chatMessageId;
public Integer chatRoomId;
......@@ -15,15 +13,16 @@ public class ChatMessageDto extends AbstractDto {
public String shopMemberName;
public String profileUrl;
public Integer selfFlg;
public Integer unreadCount;
@Override
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
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
......
......@@ -116,6 +116,7 @@ public class CommunicationLogic extends AbstractLogic {
chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate);
chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, chatMessageDto.profileUrl);
chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg);
chatMessageMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatMessageDto.unreadCount);
JSONObject jsonObject = new JSONObject(chatMessageMap);
resultJsonArray.put(jsonObject);
}
......@@ -138,6 +139,7 @@ public class CommunicationLogic extends AbstractLogic {
chatMessageMap.put(ABookCommConstants.KEY.INSERT_DATE, chatMessageDto.insertDate);
chatMessageMap.put(ABookCommConstants.KEY.PROFILE_URL, chatMessageDto.profileUrl);
chatMessageMap.put(ABookCommConstants.KEY.SELF_FLG, chatMessageDto.selfFlg);
chatMessageMap.put(ABookCommConstants.KEY.UNREAD_COUNT, chatMessageDto.unreadCount);
JSONObject jsonObject = new JSONObject(chatMessageMap);
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