Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
c4a8cda9
Commit
c4a8cda9
authored
Apr 01, 2021
by
Lee Munkyeong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
メッセージ検索
parent
712afa1f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
1 deletions
+84
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ChatMessageDao.java
+40
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/CommunicationLogic.java
+26
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/push/ABVFcmListenerService.java
+11
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
+7
-1
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ChatMessageDao.java
View file @
c4a8cda9
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
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.dto.ChatMessageDto
;
import
jp.agentec.abook.abv.bl.dto.ChatRoomDto
;
import
jp.agentec.adf.util.StringUtil
;
public
class
ChatMessageDao
extends
AbstractDao
{
...
...
@@ -99,6 +101,44 @@ public class ChatMessageDao extends AbstractDao {
return
list
;
}
public
List
<
ChatMessageDto
>
searchChatMessage
(
int
chatRoomId
,
String
[]
keywords
,
String
userList
)
{
StringBuffer
sql
=
new
StringBuffer
();
sql
.
append
(
" SELECT "
);
sql
.
append
(
" cm.chat_message_id "
);
sql
.
append
(
" ,cm.chat_room_id "
);
sql
.
append
(
" ,cm.shop_member_id "
);
sql
.
append
(
" ,cm.message "
);
sql
.
append
(
" ,cm.message_type "
);
sql
.
append
(
" ,cm.image_name "
);
sql
.
append
(
" ,cm.download_file_name "
);
sql
.
append
(
" ,cm.save_path "
);
sql
.
append
(
" ,cm.insert_date "
);
sql
.
append
(
" ,sm.shop_member_name "
);
sql
.
append
(
" ,sm.profile_url "
);
sql
.
append
(
" ,sm.self_flg "
);
sql
.
append
(
" FROM "
);
sql
.
append
(
" t_chat_message AS cm "
);
sql
.
append
(
" INNER JOIN "
);
sql
.
append
(
" m_shop_member AS sm "
);
sql
.
append
(
" ON cm.shop_member_id = sm.shop_member_id "
);
sql
.
append
(
" WHERE cm.message_type = 0 "
);
List
<
String
>
whereSqlList
=
new
ArrayList
<
String
>();
for
(
String
keyword
:
keywords
)
{
whereSqlList
.
add
(
"cm.message LIKE '%"
+
keyword
+
"%'"
);
}
String
whereSql
=
StringUtil
.
join
(
" OR "
,
whereSqlList
);
if
(!
StringUtil
.
isNullOrEmpty
(
whereSql
))
{
sql
.
append
(
"AND ("
+
whereSql
+
")"
);
}
if
(!
StringUtil
.
isNullOrEmpty
(
userList
))
{
sql
.
append
(
" AND cm.shop_member_id IN ("
+
userList
+
") "
);
}
sql
.
append
(
"AND cm.chat_room_id = ? "
);
sql
.
append
(
"ORDER BY cm.insert_date DESC "
);
List
<
ChatMessageDto
>
list
=
rawQueryGetDtoList
(
sql
.
toString
(),
new
String
[]{
""
+
chatRoomId
},
ChatMessageDto
.
class
);
return
list
;
}
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
());
}
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/CommunicationLogic.java
View file @
c4a8cda9
...
...
@@ -122,6 +122,28 @@ public class CommunicationLogic extends AbstractLogic {
return
messageListStr
;
}
public
String
searMessages
(
Integer
roomId
,
String
keyword
,
String
userList
)
{
String
[]
replacedKeyword
=
keyword
.
replaceAll
(
" "
,
" "
).
split
(
" "
);
List
<
ChatMessageDto
>
chatMessageDtoList
=
chatMessageDao
.
searchChatMessage
(
roomId
,
replacedKeyword
,
userList
);
JSONArray
resultJsonArray
=
new
JSONArray
();
for
(
ChatMessageDto
chatMessageDto
:
chatMessageDtoList
)
{
Map
<
String
,
Object
>
chatMessageMap
=
new
HashMap
<
String
,
Object
>();
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
CHAT_ROOM_ID
,
chatMessageDto
.
chatRoomId
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
LOGIN_ID
,
chatMessageDto
.
shopMemberName
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
,
chatMessageDto
.
shopMemberId
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE
,
chatMessageDto
.
message
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
MESSAGE_TYPE
,
chatMessageDto
.
messageType
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
INSERT_DATE
,
chatMessageDto
.
insertDate
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
PROFILE_URL
,
chatMessageDto
.
profileUrl
);
chatMessageMap
.
put
(
ABookCommConstants
.
KEY
.
SELF_FLG
,
chatMessageDto
.
selfFlg
);
JSONObject
jsonObject
=
new
JSONObject
(
chatMessageMap
);
resultJsonArray
.
put
(
jsonObject
);
}
String
messageListStr
=
resultJsonArray
.
toString
();
return
messageListStr
;
}
public
String
getNameCardInfo
(
Integer
shopMemberId
)
{
JSONObject
resultJson
=
new
JSONObject
();
ShopMemberDto
shopMemberDto
=
shopMemberDao
.
getShopMember
(
shopMemberId
);
...
...
@@ -437,6 +459,10 @@ public class CommunicationLogic extends AbstractLogic {
chatRoomDao
.
insertChatRoom
(
chatRoomDto
);
}
public
void
insertChatMessage
(
ChatMessageDto
chatMessageDto
)
{
chatMessageDao
.
insertChatMessage
(
chatMessageDto
);
}
public
void
updateChatRoomName
(
String
roomName
,
Integer
roomId
)
{
chatRoomDao
.
updateChatRoomName
(
roomName
,
roomId
);
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/push/ABVFcmListenerService.java
View file @
c4a8cda9
...
...
@@ -17,6 +17,7 @@ import java.util.Map;
import
jp.agentec.abook.abv.bl.common.exception.ABVException
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.dto.ChatMessageDto
;
import
jp.agentec.abook.abv.bl.dto.MemberInfoDto
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
import
jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic
;
...
...
@@ -64,6 +65,10 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
String
roomName
=
""
;
String
pushSendLoginId
=
""
;
long
pushSendDate
=
0
;
Integer
insertId
=
0
;
Integer
messageType
=
0
;
Integer
messageId
=
0
;
Log
.
d
(
TAG
,
"tempMsg : "
+
tempMsg
);
if
(
tempMsg
.
indexOf
(
"pushSendLoginId"
)
>
0
)
{
...
...
@@ -77,6 +82,12 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
pushSendDate
=
json
.
getLong
(
"pushSendDate"
);
pushMsg
=
json
.
getString
(
"message"
);
//TODO pushメッセージが到着した際、新着メッセージかルーム招待か判別してDB格納が必要
//insertId = json.getString("insertId");
//ChatMessageDto chatMessageDto = new ChatMessageDto();
//chatMessageDto.chatRoomId =
//chatRoomId shopMemberId messge messageType insertDate
if
(
pushMsg
.
length
()
>
0
)
{
tempMsg
=
pushMsg
;
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
View file @
c4a8cda9
...
...
@@ -185,7 +185,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
//ページをロード
if
(
roomId
!=
0
&&
roomName
!=
null
)
{
// by push message
String
parameterData
=
"sid="
+
sid
+
"&loginId="
+
loginId
+
"&shopName="
+
shopName
+
"&roomId="
+
roomId
+
"&roomName="
+
roomName
+
fixedParam
;
mChatWebView
.
postUrl
(
chatWebviewUrl
,
parameterData
.
getBytes
());
mChatWebView
.
postUrl
(
CHAT_ROOM_PAGE_URL
,
parameterData
.
getBytes
());
}
else
{
// Chat
if
(
lastRoomName
.
length
()
>
0
&&
lastRoomId
.
length
()
>
0
)
{
...
...
@@ -794,6 +794,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
@JavascriptInterface
public
String
searchMessages
(
String
keyword
,
String
userList
)
{
String
messageListStr
=
communicationLogic
.
searMessages
(
roomId
.
intValue
(),
keyword
,
userList
);
return
messageListStr
;
}
@JavascriptInterface
public
String
getFavoriteUsers
()
{
String
favoriteUsersStr
=
communicationLogic
.
getFavoriteUsers
();
return
favoriteUsersStr
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment