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
24332b62
Commit
24332b62
authored
Apr 02, 2021
by
Lee Munkyeong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
チャット非表示追加。
parent
d54d0f7e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
130 additions
and
22 deletions
+130
-22
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/GroupListJSON.java
+1
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookCommConstants.java
+8
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ChatRoomDao.java
+16
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ShopMemberDao.java
+23
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/TChatRoom.java
+1
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/ChatRoomDto.java
+1
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/ShopMemberDto.java
+1
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/CommunicationLogic.java
+23
-4
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
+56
-16
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/GroupListJSON.java
View file @
24332b62
...
...
@@ -60,6 +60,7 @@ public class GroupListJSON extends AcmsCommonJSON {
ShopMemberDto
shopMemberDto
=
new
ShopMemberDto
();
shopMemberDto
.
shopMemberId
=
groupMember
.
getInt
(
ABookCommConstants
.
KEY
.
SHOP_MEMBER_ID
);
shopMemberDto
.
shopMemberName
=
groupMember
.
getString
(
ABookCommConstants
.
KEY
.
MEMBER_NAME
);
shopMemberDto
.
delFlg
=
groupMember
.
getInt
(
ABookCommConstants
.
KEY
.
DEL_FLG
);
if
(
groupMember
.
has
(
ABookCommConstants
.
KEY
.
PROFILE_IMAGE_PATH
))
{
shopMemberDto
.
profileUrl
=
groupMember
.
getString
(
ABookCommConstants
.
KEY
.
PROFILE_IMAGE_PATH
);
}
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookCommConstants.java
View file @
24332b62
...
...
@@ -75,7 +75,14 @@ public interface ABookCommConstants {
Integer
OFF
=
0
;
Integer
ON
=
1
;
}
interface
DEL_FLAG
{
Integer
EXIST
=
0
;
Integer
DELETE
=
1
;
}
Integer
GROUP_REQUEST_ALL
=
0
;
}
interface
SIZE
{
Integer
MAX_FAVORITE_COUNT
=
100
;
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ChatRoomDao.java
View file @
24332b62
...
...
@@ -45,6 +45,10 @@ public class ChatRoomDao extends AbstractDao {
if
(
column
!=
-
1
)
{
dto
.
userCount
=
cursor
.
getInt
(
column
);
}
column
=
cursor
.
getColumnIndex
(
"view_flg"
);
if
(
column
!=
-
1
)
{
dto
.
viewFlg
=
cursor
.
getInt
(
column
);
}
column
=
cursor
.
getColumnIndex
(
"favorite_register_date"
);
if
(
column
!=
-
1
)
{
dto
.
favoriteRegisterDate
=
cursor
.
getString
(
column
);
...
...
@@ -82,6 +86,7 @@ public class ChatRoomDao extends AbstractDao {
sql
.
append
(
" ( SELECT max(insert_date) insert_date, message, message_type, chat_room_id FROM t_chat_message GROUP BY chat_room_id ) AS cm "
);
sql
.
append
(
" ON cr.chat_room_id = cm.chat_room_id "
);
sql
.
append
(
" WHERE cr.type =? "
);
sql
.
append
(
" AND (cr.view_flg IS null OR cr.view_flg != 1 )"
);
sql
.
append
(
" GROUP BY cr.chat_room_id "
);
sql
.
append
(
" ORDER BY CASE WHEN unread_count = 0 THEN 0 ELSE 1 END DESC, cm.insert_date DESC "
);
List
<
ChatRoomDto
>
list
=
rawQueryGetDtoList
(
sql
.
toString
(),
new
String
[]{
""
+
roomType
},
ChatRoomDto
.
class
);
...
...
@@ -130,6 +135,7 @@ public class ChatRoomDao extends AbstractDao {
}
String
whereSql
=
StringUtil
.
join
(
" OR "
,
whereSqlList
);
sql
.
append
(
whereSql
);
sql
.
append
(
" AND (cr.view_flg IS null OR cr.view_flg != 1 )"
);
sql
.
append
(
" GROUP BY cr.chat_room_id "
);
sql
.
append
(
" ORDER BY CASE WHEN unread_count = 0 THEN 0 ELSE 1 END DESC, cm.insert_date DESC "
);
List
<
ChatRoomDto
>
list
=
rawQueryGetDtoList
(
sql
.
toString
(),
null
,
ChatRoomDto
.
class
);
...
...
@@ -145,13 +151,22 @@ public class ChatRoomDao extends AbstractDao {
}
public
void
insertChatRoom
(
ChatRoomDto
dto
)
{
insert
(
"insert or replace into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date) values (?,?,?,?,?,?)"
,
dto
.
getInsertValues
());
Integer
chatRoomId
=
dto
.
chatRoomId
;
if
(
dto
.
unreadCount
==
0
)
{
insert
(
"insert or replace into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date, view_flg) values (?,?,?,?,?,?, (select view_flg from t_chat_room where chat_room_id ="
+
chatRoomId
+
"))"
,
dto
.
getInsertValues
());
}
else
{
insert
(
"insert or replace into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date, view_flg) values (?,?,?,?,?,?,0)"
,
dto
.
getInsertValues
());
}
}
public
void
updateChatRoomName
(
String
roomName
,
Integer
roomId
)
{
update
(
"update t_chat_room set chat_room_name = ? where chat_room_id = ?"
,
new
Object
[]{
roomName
,
roomId
});
}
public
void
changeRoomViewFlg
(
Integer
roomId
)
{
update
(
"update t_chat_room set view_flg = 1 where chat_room_id = ?"
,
new
String
[]{
""
+
roomId
});
}
public
void
insertChatRoom
(
List
<
ChatRoomDto
>
chatRoomDtoList
)
{
try
{
beginTransaction
();
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/ShopMemberDao.java
View file @
24332b62
...
...
@@ -276,6 +276,29 @@ public class ShopMemberDao extends AbstractDao {
return
count
>
0
;
}
public
boolean
deleteShopMember
(
ShopMemberDto
dto
)
{
long
count
=
update
(
"delete from m_shop_member where shop_member_id=?"
,
new
String
[]
{
""
+
dto
.
shopMemberId
});
return
count
>
0
;
}
public
void
deleteShopMemberByList
(
List
<
ShopMemberDto
>
dtoList
)
{
try
{
beginTransaction
();
for
(
ShopMemberDto
dto
:
dtoList
)
{
update
(
"delete from r_shop_member_group where shop_member_id=?"
,
new
String
[]
{
""
+
dto
.
shopMemberId
});
update
(
"delete from r_chat_room_shop_member where shop_member_id=?"
,
new
String
[]
{
""
+
dto
.
shopMemberId
});
update
(
"delete from m_shop_member where shop_member_id=?"
,
new
String
[]
{
""
+
dto
.
shopMemberId
});
}
commit
();
}
catch
(
Exception
e
)
{
rollback
();
Logger
.
e
(
"insertShopMember failed."
,
e
);
throw
new
RuntimeException
(
e
);
}
finally
{
}
}
public
boolean
updateFavoriteUser
(
ShopMemberDto
dto
)
{
long
count
=
update
(
"update m_shop_member set favorite_register_date=? where shop_member_id=?"
,
new
Object
[]{
dto
.
favoriteRegisterDate
,
dto
.
shopMemberId
});
return
count
>
0
;
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/TChatRoom.java
View file @
24332b62
...
...
@@ -21,6 +21,7 @@ public class TChatRoom extends SQLiteTableScript {
sql
.
append
(
" , type INTEGER NOT NULL "
);
sql
.
append
(
" , unread_count INTEGER "
);
sql
.
append
(
" , user_count INTEGER "
);
sql
.
append
(
" , view_flg INTEGER "
);
sql
.
append
(
" , favorite_register_date VARCHAR2(64) "
);
sql
.
append
(
" , PRIMARY KEY (chat_room_id) "
);
sql
.
append
(
" ) "
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/ChatRoomDto.java
View file @
24332b62
...
...
@@ -13,6 +13,7 @@ public class ChatRoomDto extends AbstractDto {
public
Integer
unreadCount
=
0
;
public
Integer
userCount
;
public
String
message
;
public
Integer
viewFlg
;
public
Integer
messageType
;
public
String
insertDate
;
public
ChatMessageDto
lastMessageInfo
;
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/ShopMemberDto.java
View file @
24332b62
...
...
@@ -9,6 +9,7 @@ public class ShopMemberDto extends AbstractDto {
public
String
profileUrl
;
public
String
favoriteRegisterDate
;
public
Integer
selfFlg
;
public
Integer
delFlg
;
public
ArrayList
<
Integer
>
groupIdList
;
@Override
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/CommunicationLogic.java
View file @
24332b62
...
...
@@ -487,6 +487,12 @@ public class CommunicationLogic extends AbstractLogic {
return
favoriteGroupsStr
;
}
public
Integer
getFavoriteCount
()
{
List
<
GroupDto
>
favoriteGroups
=
groupDao
.
getFavoriteGroup
();
List
<
ShopMemberDto
>
favoriteUsers
=
shopMemberDao
.
getfavoriteUserList
();
return
favoriteGroups
.
size
()
+
favoriteUsers
.
size
();
}
public
String
getGroupSearchData
(
Integer
groupId
)
{
//レスポンスになるJSON
...
...
@@ -613,14 +619,24 @@ public class CommunicationLogic extends AbstractLogic {
public
void
insertShopMember
(
List
<
ShopMemberDto
>
shopMemberDtoList
)
{
ShopMemberDto
myInfo
=
shopMemberDao
.
getMyInfo
();
List
<
ShopMemberDto
>
insertList
=
new
ArrayList
<
ShopMemberDto
>();
List
<
ShopMemberDto
>
deleteList
=
new
ArrayList
<
ShopMemberDto
>();
for
(
ShopMemberDto
shopMemberDto
:
shopMemberDtoList
)
{
if
(
myInfo
.
shopMemberId
.
equals
(
shopMemberDto
.
shopMemberId
))
{
shopMemberDto
.
selfFlg
=
1
;
if
(
ABookCommConstants
.
FLAG
.
DEL_FLAG
.
EXIST
.
equals
(
shopMemberDto
.
delFlg
))
{
if
(
myInfo
.
shopMemberId
.
equals
(
shopMemberDto
.
shopMemberId
))
{
shopMemberDto
.
selfFlg
=
1
;
}
else
{
shopMemberDto
.
selfFlg
=
0
;
}
insertList
.
add
(
shopMemberDto
);
}
else
{
shopMemberDto
.
selfFlg
=
0
;
deleteList
.
add
(
shopMemberDto
)
;
}
}
shopMemberDao
.
insertShopMember
(
shopMemberDtoList
);
shopMemberDao
.
insertShopMember
(
insertList
);
shopMemberDao
.
deleteShopMemberByList
(
deleteList
);
}
public
void
updateGroup
(
List
<
GroupDto
>
GroupList
)
{
...
...
@@ -710,6 +726,9 @@ public class CommunicationLogic extends AbstractLogic {
shopMemberDao
.
deleteShopMember
();
}
public
void
roomDisplayOff
(
Integer
roomId
)
{
chatRoomDao
.
changeRoomViewFlg
(
roomId
);
}
public
String
getUserList
(
String
userIdList
)
{
List
<
ShopMemberDto
>
selectedUsers
=
shopMemberDao
.
getSelectedUsers
(
userIdList
);
JSONArray
attendUsers
=
new
JSONArray
();
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
View file @
24332b62
...
...
@@ -140,6 +140,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
if
(
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
checkSid
(
sid
))
{
isOnline
=
true
;
chatWebviewUrl
=
CHAT_PAGE_URL
;
communicationLogic
.
clearAllData
();
updateMyInfoFromServer
();
updateAllGroupInfo
();
updateFavoriteInfo
();
...
...
@@ -729,7 +730,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
public
void
updateRoomList
()
throws
NetworkDisconnectedException
,
AcmsException
{
Map
<
String
,
Object
>
chatRoomList
;
RoomListJSON
resultJson
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
getRoomList
(
sid
);
communicationLogic
.
deleteChatRoomList
();
//
communicationLogic.deleteChatRoomList();
communicationLogic
.
insertChatRoomList
(
resultJson
.
roomList
);
}
...
...
@@ -761,7 +762,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView
.
loadUrl
(
String
.
format
(
"javascript:CHAT_UI.joinRoom('%s', '%s');"
,
chatRoomId
,
chatRoomName
));
}
});
}
@JavascriptInterface
...
...
@@ -787,6 +787,18 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
});
}
@JavascriptInterface
public
void
roomDisplayOff
()
{
communicationLogic
.
roomDisplayOff
(
roomId
.
intValue
());
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
CHAT_PAGE_URL
);
}
});
}
@JavascriptInterface
public
void
inviteUsers
(
String
userIds
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
inviteUsers
(
sid
,
roomId
.
intValue
(),
roomName
,
userIds
);
...
...
@@ -922,15 +934,28 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
@JavascriptInterface
public
void
addFavoriteUser
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
insertFavoriteUser
(
shopMemberId
);
if
(!
result
)
{
return
;
}
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.refreshContactScreen();"
);
}
});
public
boolean
addFavoriteUser
(
String
shopMemberId
)
throws
NetworkDisconnectedException
,
AcmsException
{
Integer
favoriteCount
=
communicationLogic
.
getFavoriteCount
();
if
(
favoriteCount
>=
ABookCommConstants
.
SIZE
.
MAX_FAVORITE_COUNT
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:alert('"
+
"お気に入りは最大100件までです。"
+
"');"
);
}
});
return
false
;
}
else
{
boolean
result
=
insertFavoriteUser
(
shopMemberId
);
if
(!
result
)
{
return
false
;
}
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.refreshContactScreen();"
);
}
});
return
true
;
}
}
@JavascriptInterface
...
...
@@ -947,15 +972,29 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
@JavascriptInterface
public
void
addFavoriteGroup
(
String
groupId
)
throws
NetworkDisconnectedException
,
AcmsException
{
boolean
result
=
insertFavoriteGroup
(
groupId
);
if
(
result
)
{
public
boolean
addFavoriteGroup
(
String
groupId
)
throws
NetworkDisconnectedException
,
AcmsException
{
Integer
favoriteCount
=
communicationLogic
.
getFavoriteCount
();
if
(
favoriteCount
>=
ABookCommConstants
.
SIZE
.
MAX_FAVORITE_COUNT
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:
CHAT_UI.refreshContactScreen(
);"
);
mChatWebView
.
loadUrl
(
"javascript:
alert('"
+
"お気に入りは最大100件までです。"
+
"'
);"
);
}
});
return
false
;
}
else
{
boolean
result
=
insertFavoriteGroup
(
groupId
);
if
(
result
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.refreshContactScreen();"
);
}
});
return
true
;
}
return
false
;
}
}
...
...
@@ -1046,7 +1085,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
SharedPreferences
pref
=
getSharedPreferences
(
ABookCommConstants
.
TAG
,
MODE_PRIVATE
);
for
(
String
groupId
:
groupIds
.
split
(
","
))
{
checkSumList
.
add
(
pref
.
getString
(
groupId
,
DEFAULT_CHECKSUM
));
//checkSumList.add(pref.getString(groupId,DEFAULT_CHECKSUM));
checkSumList
.
add
(
DEFAULT_CHECKSUM
);
}
String
checkSumListStr
=
StringUtil
.
join
(
","
,
checkSumList
);
if
(
groupIds
.
equals
(
ABookCommConstants
.
FLAG
.
GROUP_REQUEST_ALL
.
toString
()))
{
...
...
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